xref: /MusicFree/src/pages/home/components/operations/index.tsx (revision 6704747af84cebd842b258efac7143542722fac5)
1import {produce} from 'immer';
2import {useSetAtom} from 'jotai';
3import React, {type PropsWithChildren} from 'react';
4import {Button, ScrollView, StyleSheet, Text, View} from 'react-native';
5import rpx from '@/utils/rpx';
6import ActionButton from './ActionButton';
7import {useNavigation} from '@react-navigation/native';
8import {ROUTE_PATH} from '@/entry/router';
9
10export default function Operations() {
11  const navigation = useNavigation<any>();
12
13  const actionButtons = [
14    {
15      iconName: 'heart',
16      iconColor: 'red',
17      title: '我喜欢',
18      action() {
19        navigation.navigate(ROUTE_PATH.SHEET_DETAIL, {
20          id: 'favorite',
21        });
22      },
23    },
24    {
25      iconName: 'folder-music-outline',
26      title: '本地音乐',
27      action() {
28        navigation.navigate(ROUTE_PATH.LOCAL);
29      },
30    },
31    // {
32    //   iconName: 'ios-time-sharp',
33    //   title: '最近播放',
34    //   action(){
35    //     console.log('最近');
36    //   }
37    // },
38    {
39      iconName: 'download-circle-outline',
40      title: '下载列表',
41      action() {
42        navigation.navigate(ROUTE_PATH.DOWNLOADING);
43      },
44    },
45  ];
46
47  return (
48    <View style={style.wrapper}>
49      {actionButtons.map(action => (
50        <ActionButton key={action.title} {...action}></ActionButton>
51      ))}
52    </View>
53  );
54}
55
56const style = StyleSheet.create({
57  wrapper: {
58    width: rpx(750),
59    flexDirection: 'row',
60    height: rpx(144),
61    justifyContent: 'space-between',
62    paddingHorizontal: rpx(24),
63    marginTop: rpx(24),
64  },
65});
66