xref: /MusicFree/src/pages/home/components/homeBody/operations.tsx (revision b4c389f44ac4dad056e7314478fadd2eca82a4b1)
1f90698e4S猫头猫import React from 'react';
2f90698e4S猫头猫import {StyleSheet, View} from 'react-native';
3f90698e4S猫头猫import rpx from '@/utils/rpx';
4f90698e4S猫头猫import ActionButton from '../ActionButton';
5*b4c389f4Smaotoumaoimport {ROUTE_PATH, useNavigate} from '@/core/router';
6f90698e4S猫头猫
7f90698e4S猫头猫export default function Operations() {
8f90698e4S猫头猫    const navigate = useNavigate();
9f90698e4S猫头猫
10f90698e4S猫头猫    const actionButtons = [
11f90698e4S猫头猫        {
12f90698e4S猫头猫            iconName: 'fire',
13f90698e4S猫头猫            title: '推荐歌单',
14f90698e4S猫头猫            action() {
15f90698e4S猫头猫                navigate(ROUTE_PATH.RECOMMEND_SHEETS);
16f90698e4S猫头猫            },
17f90698e4S猫头猫        },
18f90698e4S猫头猫        {
195589cdf3S猫头猫            iconName: 'trophy',
20f90698e4S猫头猫            title: '榜单',
21f90698e4S猫头猫            action() {
22f90698e4S猫头猫                navigate(ROUTE_PATH.TOP_LIST);
23f90698e4S猫头猫            },
24f90698e4S猫头猫        },
25f90698e4S猫头猫        {
265589cdf3S猫头猫            iconName: 'clock-outline',
27f90698e4S猫头猫            title: '播放记录',
28f90698e4S猫头猫            action() {
29f90698e4S猫头猫                navigate(ROUTE_PATH.HISTORY);
30f90698e4S猫头猫            },
31f90698e4S猫头猫        },
32f90698e4S猫头猫        {
33f90698e4S猫头猫            iconName: 'folder-music-outline',
34f90698e4S猫头猫            title: '本地音乐',
35f90698e4S猫头猫            action() {
36f90698e4S猫头猫                navigate(ROUTE_PATH.LOCAL);
37f90698e4S猫头猫            },
38f90698e4S猫头猫        },
395589cdf3S猫头猫    ] as const;
40f90698e4S猫头猫
41f90698e4S猫头猫    return (
42f90698e4S猫头猫        <View style={styles.container}>
43f90698e4S猫头猫            {actionButtons.map((action, index) => (
44f90698e4S猫头猫                <ActionButton
45f90698e4S猫头猫                    style={[
46f90698e4S猫头猫                        styles.actionButtonStyle,
47f90698e4S猫头猫                        index % 4 ? styles.actionMarginLeft : null,
48f90698e4S猫头猫                    ]}
49f90698e4S猫头猫                    key={action.title}
50f90698e4S猫头猫                    {...action}
51f90698e4S猫头猫                />
52f90698e4S猫头猫            ))}
53f90698e4S猫头猫        </View>
54f90698e4S猫头猫    );
55f90698e4S猫头猫}
56f90698e4S猫头猫
57f90698e4S猫头猫const styles = StyleSheet.create({
58f90698e4S猫头猫    container: {
59f90698e4S猫头猫        width: rpx(750),
60f90698e4S猫头猫        paddingHorizontal: rpx(24),
61f90698e4S猫头猫        marginVertical: rpx(32),
62f90698e4S猫头猫        flexDirection: 'row',
631d8853acS猫头猫        flexWrap: 'nowrap',
64f90698e4S猫头猫    },
65f90698e4S猫头猫    actionButtonStyle: {
66f90698e4S猫头猫        width: rpx(157.5),
67f90698e4S猫头猫        height: rpx(160),
68f90698e4S猫头猫        borderRadius: rpx(18),
69f90698e4S猫头猫    },
70f90698e4S猫头猫    actionMarginLeft: {
71f90698e4S猫头猫        marginLeft: rpx(24),
72f90698e4S猫头猫    },
73f90698e4S猫头猫});
74