#
luxiaotao1123
2024-09-09 05a5ac117a0376d265564e590c5d117b5af6f812
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import React, { useState, useRef, useEffect, useMemo, useCallback } from "react";
import {
    SavedQueriesList,
    FilterLiveSearch,
    FilterList,
    FilterListItem,
    useTheme,
    useStore,
} from 'react-admin';
import { Box, Typography, Card, CardContent } from '@mui/material';
import { styled } from '@mui/material/styles';
import { DEFAULT_THEME_NAME } from '@/config/setting';
import * as Common from '@/utils/common';
import MailIcon from '@mui/icons-material/MailOutline'
import BookmarkIcon from '@mui/icons-material/BookmarkBorder';
import CategoryIcon from '@mui/icons-material/LocalOffer';
import {
    endOfYesterday,
    startOfWeek,
    subWeeks,
    startOfMonth,
    subMonths,
} from 'date-fns';
 
const UserListAside = (props) => {
    const theme = useTheme();
    const [themeName] = useStore('themeName', DEFAULT_THEME_NAME);
    console.log()
 
    const isSelected = (value, filters) => {
        const categories = filters.categories || [];
        return categories.includes(value.category);
    };
 
    const toggleFilter = (value, filters) => {
        const categories = filters.categories || [];
        return {
            ...filters,
            categories: categories.includes(value.category)
                // Remove the category if it was already present
                ? categories.filter(v => v !== value.category)
                // Add the category if it wasn't already present
                : [...categories, value.category],
        };
    };
 
 
    return (
        <>
            <Card
                sx={{
                    display: { xs: 'none', md: 'block', },
                    order: -1,
                    mr: 2,
                    mt: 8,
                    alignSelf: 'flex-start',
                    border: theme[0] === 'light' && '1px solid #e0e0e3',
                    // borderRadius: 0,
                    // width: 200
                }}
            >
                <CardContent>
                    <SavedQueriesList icon={<BookmarkIcon />} />
 
                    <FilterLiveSearch source='condition' hiddenLabel />
 
                    <FilterList label="aa" icon={<MailIcon />}>
                        <FilterListItem label="Yes" value={{ status: '1' }} />
                        <FilterListItem label="No" value={{ status: '0' }} />
                    </FilterList>
 
                    <FilterList label="Categories" icon={<CategoryIcon />}>
                        <FilterListItem
                            label="Tests"
                            value={{ category: 'tests' }}
                            isSelected={isSelected}
                            toggleFilter={toggleFilter}
                        />
                        <FilterListItem
                            label="News"
                            value={{ category: 'news' }}
                            isSelected={isSelected}
                            toggleFilter={toggleFilter}
                        />
                        <FilterListItem
                            label="Deals"
                            value={{ category: 'deals' }}
                            isSelected={isSelected}
                            toggleFilter={toggleFilter}
                        />
                    </FilterList>
                </CardContent>
            </Card>
        </>
    )
}
 
export default UserListAside;