From 18db0c17ff865a489379a53aa29a28817c6913d4 Mon Sep 17 00:00:00 2001 From: Sean Edmunds Date: Wed, 28 Aug 2024 17:06:37 -0500 Subject: [PATCH] Working empty version --- src/App.tsx | 2 +- src/DataTable/DataTable.tsx | 4 +- src/DataTable/columns/ApplicationColumns.tsx | 38 ++------ src/DataTable/columns/BookmarkColumns.tsx | 28 +----- src/DataTable/columns/CategoryColumns.tsx | 18 ++-- src/DataTable/columns/MessagesColumns.tsx | 24 ----- .../columns/PersonalizationColumns.tsx | 24 ++--- src/components/ThemeProvider.tsx | 12 +-- src/pages/homepage/Homepage.tsx | 30 +++--- .../homepage/components/Applications.tsx | 71 +++++++------- src/pages/homepage/components/Bookmarks.tsx | 10 +- src/pages/homepage/components/MessageInfo.jsx | 2 +- src/pages/homepage/components/Search.tsx | 1 + .../homepage/components/SettingsButton.tsx | 31 +++++-- src/pages/settings/components/Bookmarks.tsx | 18 ++-- .../settings/components/Personalization.tsx | 2 +- .../settings/components/ThemeModalContent.tsx | 28 +++--- src/pages/settings/components/Themes.tsx | 93 ++++++++++--------- 18 files changed, 198 insertions(+), 238 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 01e54ed..0b136b1 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -52,7 +52,7 @@ function App() { ); const overrides = createTheme({ - white: theme?.colorbackground, + white: theme?.backgroundColor, fontFamily: '-apple-system,Jost,BlinkMacSystemFont,Helvetica Neue,Roboto,sans-serif', }); diff --git a/src/DataTable/DataTable.tsx b/src/DataTable/DataTable.tsx index c49e0fb..7e5400a 100644 --- a/src/DataTable/DataTable.tsx +++ b/src/DataTable/DataTable.tsx @@ -22,6 +22,7 @@ export function DataTableComponent({ isFetching, isLoading, endpoint, + grouping, }: { tableName: string; columns: any; @@ -29,6 +30,7 @@ export function DataTableComponent({ isFetching: boolean; isLoading: boolean; endpoint: string; + grouping?: string; }) { const [theme, setTheme] = useAtom(appTheme); const { mutateAsync: createRow } = useMutationAPI(); @@ -98,7 +100,7 @@ export function DataTableComponent({ ), mantineCreateRowModalProps: { style: { - color: theme.colortextpri, + color: theme.primary, }, }, renderTopToolbarCustomActions: ({ table }) => { diff --git a/src/DataTable/columns/ApplicationColumns.tsx b/src/DataTable/columns/ApplicationColumns.tsx index dd070e7..c9f1909 100644 --- a/src/DataTable/columns/ApplicationColumns.tsx +++ b/src/DataTable/columns/ApplicationColumns.tsx @@ -15,10 +15,6 @@ export default function ApplicationColumns() { id: 'id', header: 'ID', size: 50, - mantineCopyButtonProps: ({ cell, row }) => ({ - className: 'id', - id: `${cell.getValue()}-id`, - }), Cell: ({ renderedCellValue, row }) => renderedCellValue, Header: ({ column }) => column.columnDef.header, }, @@ -31,10 +27,6 @@ export default function ApplicationColumns() { }, id: 'name', header: 'Name', - mantineCopyButtonProps: ({ cell, row }) => ({ - className: 'name', - id: `${cell.getValue()}-name`, - }), Cell: ({ renderedCellValue, row }) => renderedCellValue, Header: ({ column }) => column.columnDef.header, }, @@ -47,10 +39,6 @@ export default function ApplicationColumns() { }, id: 'url', header: 'Url', - mantineCopyButtonProps: ({ cell, row }) => ({ - className: 'url', - id: `${cell.getValue()}-url`, - }), Cell: ({ renderedCellValue, row }) => renderedCellValue, Header: ({ column }) => column.columnDef.header, }, @@ -63,42 +51,30 @@ export default function ApplicationColumns() { }, id: 'icon', header: 'Icon', - mantineCopyButtonProps: ({ cell, row }) => ({ - className: 'icon', - id: `${cell.getValue()}-icon`, - }), Cell: ({ renderedCellValue, row }) => renderedCellValue, Header: ({ column }) => column.columnDef.header, }, { accessorFn: (row) => { - if (row.urlbase) { - return `${row.urlbase}`; + if (row.baseUrl) { + return `${row.baseUrl}`; } return ''; }, - id: 'urlbase', + id: 'baseUrl', header: 'Base Url', - mantineCopyButtonProps: ({ cell, row }) => ({ - className: 'urlbase', - id: `${cell.getValue()}-urlbase`, - }), Cell: ({ renderedCellValue, row }) => renderedCellValue, Header: ({ column }) => column.columnDef.header, }, { accessorFn: (row) => { - if (row.category) { - return `${row.category}`; + if (row.filterName) { + return `${row.filterName}`; } return ''; }, - id: 'category', - header: 'Category', - mantineCopyButtonProps: ({ cell, row }) => ({ - className: 'category', - id: `${cell.getValue()}-category`, - }), + id: 'filterName', + header: 'Filter Name', Cell: ({ renderedCellValue, row }) => renderedCellValue, Header: ({ column }) => column.columnDef.header, }, diff --git a/src/DataTable/columns/BookmarkColumns.tsx b/src/DataTable/columns/BookmarkColumns.tsx index 39edb40..c4e2704 100644 --- a/src/DataTable/columns/BookmarkColumns.tsx +++ b/src/DataTable/columns/BookmarkColumns.tsx @@ -1,7 +1,7 @@ import type { MRT_ColumnDef } from 'mantine-react-table'; import { useMemo } from 'react'; -export default function ApplicationColumns(groups: any, groupData: any) { +export default function ApplicationColumns(groups: any) { const columns = useMemo[]>( () => [ { @@ -15,10 +15,6 @@ export default function ApplicationColumns(groups: any, groupData: any) { id: 'id', header: 'ID', size: 50, - mantineCopyButtonProps: ({ cell, row }) => ({ - className: 'id', - id: `${cell.getValue()}-id`, - }), Cell: ({ renderedCellValue, row }) => renderedCellValue, Header: ({ column }) => column.columnDef.header, }, @@ -31,10 +27,6 @@ export default function ApplicationColumns(groups: any, groupData: any) { }, id: 'name', header: 'Name', - mantineCopyButtonProps: ({ cell, row }) => ({ - className: 'name', - id: `${cell.getValue()}-name`, - }), Cell: ({ renderedCellValue, row }) => renderedCellValue, Header: ({ column }) => column.columnDef.header, }, @@ -47,31 +39,21 @@ export default function ApplicationColumns(groups: any, groupData: any) { }, id: 'url', header: 'Url', - mantineCopyButtonProps: ({ cell, row }) => ({ - className: 'url', - id: `${cell.getValue()}-url`, - }), Cell: ({ renderedCellValue, row }) => renderedCellValue, Header: ({ column }) => column.columnDef.header, }, { accessorFn: (row) => { - const index: number = row.category; - if (index !== null && index !== undefined) { - return `${index}`; + if (row.category) { + return `${row.category}`; } - return 'N/A'; + return ''; }, id: 'category', header: 'Category', editVariant: 'select', mantineEditSelectProps: { data: groups }, - mantineCopyButtonProps: ({ cell, row }) => ({ - className: 'category', - id: `${cell.getValue()}-category`, - }), - Cell: ({ renderedCellValue, row }) => - groupData[row?.original.category].category_name, + Cell: ({ renderedCellValue }) => renderedCellValue, Header: ({ column }) => column.columnDef.header, }, ], diff --git a/src/DataTable/columns/CategoryColumns.tsx b/src/DataTable/columns/CategoryColumns.tsx index 8ab175f..2a18dd5 100644 --- a/src/DataTable/columns/CategoryColumns.tsx +++ b/src/DataTable/columns/CategoryColumns.tsx @@ -20,12 +20,12 @@ export default function CategoryColumns() { }, { accessorFn: (row) => { - if (row.category_name) { - return `${row.category_name}`; + if (row.categoryName) { + return `${row.categoryName}`; } return ''; }, - id: 'category_name', + id: 'categoryName', header: 'Name', size: 50, Cell: ({ renderedCellValue, row }) => renderedCellValue, @@ -33,13 +33,13 @@ export default function CategoryColumns() { }, { accessorFn: (row) => { - if (row.category_index > -1) { - return `${row.category_index}`; + if (row.categoryIndex > -1) { + return `${row.categoryIndex}`; } return ''; }, enableEditing: false, - id: 'category_index', + id: 'categoryIndex', header: 'Index', size: 50, Cell: ({ renderedCellValue, row }) => renderedCellValue, @@ -47,12 +47,12 @@ export default function CategoryColumns() { }, { accessorFn: (row) => { - if (row.column_filter) { - return `${row.column_filter}`; + if (row.filterName) { + return `${row.filterName}`; } return ''; }, - id: 'column_filter', + id: 'filterName', header: 'Filter Name', size: 50, Cell: ({ renderedCellValue, row }) => renderedCellValue, diff --git a/src/DataTable/columns/MessagesColumns.tsx b/src/DataTable/columns/MessagesColumns.tsx index 0945142..baf15e4 100644 --- a/src/DataTable/columns/MessagesColumns.tsx +++ b/src/DataTable/columns/MessagesColumns.tsx @@ -15,10 +15,6 @@ export default function MessagesColumns() { id: 'id', header: 'ID', size: 50, - mantineCopyButtonProps: ({ cell, row }) => ({ - className: 'id', - id: `${cell.getValue()}-id`, - }), Cell: ({ renderedCellValue, row }) => renderedCellValue, Header: ({ column }) => column.columnDef.header, }, @@ -31,26 +27,6 @@ export default function MessagesColumns() { }, id: 'message', header: 'Message', - mantineCopyButtonProps: ({ cell, row }) => ({ - className: 'message', - id: `${cell.getValue()}-message`, - }), - Cell: ({ renderedCellValue, row }) => renderedCellValue, - Header: ({ column }) => column.columnDef.header, - }, - { - accessorFn: (row) => { - if (row.easteregg) { - return `${row.easteregg}`; - } - return ''; - }, - id: 'easteregg', - header: 'Easter Egg?', - mantineCopyButtonProps: ({ cell, row }) => ({ - className: 'easteregg', - id: `${cell.getValue()}-easteregg`, - }), Cell: ({ renderedCellValue, row }) => renderedCellValue, Header: ({ column }) => column.columnDef.header, }, diff --git a/src/DataTable/columns/PersonalizationColumns.tsx b/src/DataTable/columns/PersonalizationColumns.tsx index d2d6e8f..bae54af 100644 --- a/src/DataTable/columns/PersonalizationColumns.tsx +++ b/src/DataTable/columns/PersonalizationColumns.tsx @@ -6,34 +6,26 @@ export default function PersonalizationColumns() { () => [ { accessorFn: (row: any) => { - if (row.firstname) { - return `${row.firstname}`; + if (row.firstName) { + return `${row.firstName}`; } return ''; }, - id: 'firstname', + id: 'firstName', header: 'First Name', size: 50, - mantineCopyButtonProps: ({ cell, row }) => ({ - className: 'firstname', - id: `${cell.getValue()}-firstname`, - }), Cell: ({ renderedCellValue, row }) => renderedCellValue, Header: ({ column }) => column.columnDef.header, }, { accessorFn: (row: any) => { - if (row.lastname) { - return `${row.lastname}`; + if (row.lastName) { + return `${row.lastName}`; } return ''; }, - id: 'lastname', + id: 'lastName', header: 'Last Name', - mantineCopyButtonProps: ({ cell, row }) => ({ - className: 'lastname', - id: `${cell.getValue()}-lastname`, - }), Cell: ({ renderedCellValue, row }) => renderedCellValue, Header: ({ column }) => column.columnDef.header, }, @@ -46,10 +38,6 @@ export default function PersonalizationColumns() { }, id: 'email', header: 'Email', - mantineCopyButtonProps: ({ cell, row }) => ({ - className: 'email', - id: `${cell.getValue()}-email`, - }), Cell: ({ renderedCellValue, row }) => renderedCellValue, Header: ({ column }) => column.columnDef.header, }, diff --git a/src/components/ThemeProvider.tsx b/src/components/ThemeProvider.tsx index 9bf23c2..c268bde 100644 --- a/src/components/ThemeProvider.tsx +++ b/src/components/ThemeProvider.tsx @@ -7,12 +7,12 @@ export default function ThemeProvider({ return ( {children} diff --git a/src/pages/homepage/Homepage.tsx b/src/pages/homepage/Homepage.tsx index 981a624..ca171d6 100644 --- a/src/pages/homepage/Homepage.tsx +++ b/src/pages/homepage/Homepage.tsx @@ -13,9 +13,13 @@ import { useLocalStorage } from '@mantine/hooks'; export default function Homepage({ theme }: any) { const { data, isFetching } = useQueryAPI({ endpoint: 'api/messages' }); const [displayedGreeting, setDisplayedGreeting] = useState(''); - const [contentType, setContentType] = useLocalStorage({ - key: 'contenttype', - defaultValue: 'All', + const [appFilter, setAppFilter] = useLocalStorage<[any]>({ + key: 'appFilter', + defaultValue: ['All'], + }); + const [bookmarkFilter, setBookmarkFilter] = useLocalStorage<[any]>({ + key: 'bookmarkFilter', + defaultValue: ['All'], }); function date() { const currentDate = new Date(); @@ -33,18 +37,18 @@ export default function Homepage({ theme }: any) { const greet = Math.floor(currentTime.getHours() / 6); const easterEggChance = Math.floor(Math.random() * 100); let timeBased: any = []; - let easterEggs: any = []; + let customGreetings: any = []; for (const l of list) { - if (l.easteregg === 'N') { + if (l.customGreeting === 0) { timeBased = timeBased.concat(l); } else { - easterEggs = easterEggs.concat(l); + customGreetings = customGreetings.concat(l); } } - if (easterEggChance > 10 || easterEggs.length === 0) { + if (easterEggChance > 10 || customGreetings.length === 0) { return timeBased[greet].message; } - return easterEggs[Math.floor(Math.random() * easterEggs.length)].message; + return customGreetings[Math.floor(Math.random() * customGreetings.length)].message; } useEffect(() => { @@ -57,12 +61,14 @@ export default function Homepage({ theme }: any) {
- - + + ); diff --git a/src/pages/homepage/components/Applications.tsx b/src/pages/homepage/components/Applications.tsx index 8f7e487..23c890f 100644 --- a/src/pages/homepage/components/Applications.tsx +++ b/src/pages/homepage/components/Applications.tsx @@ -13,38 +13,45 @@ function Applications({ contentType }: any) { } }, [isFetching]); return ( - - - Applications - - - {applications?.map((item: any) => { - if (item.category === contentType || contentType === 'All') - return ( - - ); - })} - - + <> + {applications.length > 0 && ( + + + Applications + + + {applications?.map((application: any) => { + if ( + contentType.includes(application.filterName) || + contentType.includes('All') + ) + return ( + + ); + })} + + + )} + ); } diff --git a/src/pages/homepage/components/Bookmarks.tsx b/src/pages/homepage/components/Bookmarks.tsx index 7d51254..2a5efe1 100644 --- a/src/pages/homepage/components/Bookmarks.tsx +++ b/src/pages/homepage/components/Bookmarks.tsx @@ -20,7 +20,6 @@ function Links({ contentType }: any) { setCategories(groupData); } }, [linksIsFetched, groupsIsFetched]); - return ( <> {groupsIsFetched && linksIsFetched && categories?.length > 0 && ( @@ -39,13 +38,16 @@ function Links({ contentType }: any) { }} > {categories.map((category: any) => { - if (category.column_filter === contentType || contentType === 'All') { + if ( + contentType.includes(category.filterName) || + contentType.includes('All') + ) { return ( bookmark.category === category.category_index, + (bookmark: any) => bookmark.category === category.categoryName, )} /> ); diff --git a/src/pages/homepage/components/MessageInfo.jsx b/src/pages/homepage/components/MessageInfo.jsx index 9c824a7..62cde55 100644 --- a/src/pages/homepage/components/MessageInfo.jsx +++ b/src/pages/homepage/components/MessageInfo.jsx @@ -22,7 +22,7 @@ function MessageInfo() { group={index + 1} index={greeting.index} greeting={greeting.message} - easterEgg={greeting.easteregg} + easterEgg={greeting.customGreeting} /> ))} diff --git a/src/pages/homepage/components/Search.tsx b/src/pages/homepage/components/Search.tsx index 9ff7207..59d361b 100644 --- a/src/pages/homepage/components/Search.tsx +++ b/src/pages/homepage/components/Search.tsx @@ -63,6 +63,7 @@ export default function Search() { }} > { - return { value: category.category, label: category.category }; + return { value: category.filterName, label: category.filterName }; }) || []; list.unshift({ value: 'All', label: 'All' }); setCategories(list); @@ -57,13 +63,24 @@ function SettingsButton({ contentType, setContentType, theme }: any) { classNames={navLink} /> -