Styled Homepage
This commit is contained in:
40
src/App.css
40
src/App.css
@@ -1,40 +0,0 @@
|
|||||||
#root {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logo {
|
|
||||||
height: 6em;
|
|
||||||
padding: 1.5em;
|
|
||||||
will-change: filter;
|
|
||||||
transition: filter 300ms;
|
|
||||||
}
|
|
||||||
.logo:hover {
|
|
||||||
filter: drop-shadow(0 0 2em #646cffaa);
|
|
||||||
}
|
|
||||||
.logo.react:hover {
|
|
||||||
filter: drop-shadow(0 0 2em #61dafbaa);
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes logo-spin {
|
|
||||||
from {
|
|
||||||
transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-reduced-motion: no-preference) {
|
|
||||||
a:nth-of-type(2) .logo {
|
|
||||||
animation: logo-spin infinite 20s linear;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.card {
|
|
||||||
padding: 2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.read-the-docs {
|
|
||||||
color: #888;
|
|
||||||
}
|
|
||||||
58
src/App.tsx
58
src/App.tsx
@@ -1,43 +1,65 @@
|
|||||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
||||||
import './App.css'
|
|
||||||
import Homepage from './pages/homepage/Homepage'
|
import Homepage from './pages/homepage/Homepage'
|
||||||
import { MantineProvider } from '@mantine/core'
|
import { MantineProvider, DEFAULT_THEME, createTheme, mergeMantineTheme } from '@mantine/core'
|
||||||
import {
|
import {
|
||||||
Route,
|
Route,
|
||||||
createBrowserRouter,
|
createBrowserRouter,
|
||||||
createRoutesFromElements,
|
createRoutesFromElements,
|
||||||
RouterProvider,
|
RouterProvider,
|
||||||
Navigate,
|
|
||||||
} from "react-router-dom";
|
} from "react-router-dom";
|
||||||
import Settings from './pages/settings/Settings';
|
import Settings from './pages/settings/Settings';
|
||||||
|
import { ModalsProvider } from '@mantine/modals';
|
||||||
|
import { useLocalStorage } from '@mantine/hooks';
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
import { useQueryAPI } from './hooks/useAPI';
|
||||||
|
import ThemeProvider from './components/ThemeProvider';
|
||||||
|
import '@mantine/core/styles.css'; //import Mantine V7 styles needed by MRT
|
||||||
|
import '@mantine/dates/styles.css'; //if using mantine date picker features
|
||||||
|
import 'mantine-react-table/styles.css'; //import MRT styles
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const queryClient = new QueryClient({
|
|
||||||
defaultOptions: {
|
const { data, isFetched } = useQueryAPI({
|
||||||
queries: {
|
endpoint: "api/themes",
|
||||||
gcTime: 1000 * 60 * 60 * 24, // 24 hours
|
|
||||||
staleTime: 1000 * 60 * 1, // 1 min
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const [themeName, setThemeName] = useLocalStorage<any>({
|
||||||
|
key: 'theme',
|
||||||
|
defaultValue: 'blackboard',
|
||||||
|
});
|
||||||
|
|
||||||
|
const [currentTheme, setCurrentTheme] = useState<any>({});
|
||||||
|
|
||||||
|
const overrides = createTheme({
|
||||||
|
white:currentTheme.colorbackground,
|
||||||
|
fontFamily: '-apple-system,Jost,BlinkMacSystemFont,Helvetica Neue,Roboto,sans-serif',
|
||||||
|
});
|
||||||
|
|
||||||
|
const mantineTheme = mergeMantineTheme(DEFAULT_THEME, overrides);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if(data && themeName) {
|
||||||
|
let temp = data.find((t: any) => t.name === themeName)
|
||||||
|
setCurrentTheme(temp);
|
||||||
|
}
|
||||||
|
}, [isFetched, themeName])
|
||||||
|
|
||||||
const router = createBrowserRouter(
|
const router = createBrowserRouter(
|
||||||
createRoutesFromElements(
|
createRoutesFromElements(
|
||||||
<Route>
|
<Route>
|
||||||
<Route path="/trigger" element={<Homepage />}></Route>
|
<Route path="/trigger" element={<Homepage theme={currentTheme} />} />
|
||||||
<Route path="/trigger/settings" element={<Settings />}></Route>
|
<Route path="/trigger/settings" element={<Settings theme={currentTheme}/>} />
|
||||||
</Route>,
|
</Route>,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<QueryClientProvider client={queryClient}>
|
<MantineProvider theme={mantineTheme}>
|
||||||
<MantineProvider theme={{
|
<ThemeProvider theme={currentTheme}>
|
||||||
fontFamily: '-apple-system,Jost,BlinkMacSystemFont,Helvetica Neue,Roboto,sans-serif',
|
<ModalsProvider>
|
||||||
}}>
|
|
||||||
<RouterProvider router={router} />
|
<RouterProvider router={router} />
|
||||||
|
</ModalsProvider>
|
||||||
|
</ThemeProvider>
|
||||||
</MantineProvider>
|
</MantineProvider>
|
||||||
</QueryClientProvider>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
import { ModalsProvider } from "@mantine/modals";
|
|
||||||
import { MantineReactTable, useMantineReactTable } from "mantine-react-table"
|
import { MantineReactTable, useMantineReactTable } from "mantine-react-table"
|
||||||
import { memo } from "react";
|
import { memo } from "react";
|
||||||
// import '../dataTableStyles.css';
|
|
||||||
import '@mantine/core/styles.css'; //import Mantine V7 styles needed by MRT
|
|
||||||
import '@mantine/dates/styles.css'; //if using mantine date picker features
|
|
||||||
import 'mantine-react-table/styles.css'; //import MRT styles
|
|
||||||
|
|
||||||
export function DataTableComponent({
|
export function DataTableComponent({
|
||||||
columns,
|
columns,
|
||||||
@@ -88,9 +83,7 @@ export function DataTableComponent({
|
|||||||
// },
|
// },
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<ModalsProvider>
|
|
||||||
<MantineReactTable table={table} />
|
<MantineReactTable table={table} />
|
||||||
</ModalsProvider>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { MRT_ColumnDef } from "mantine-react-table";
|
import type { MRT_ColumnDef } from "mantine-react-table";
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
|
|
||||||
export default function ApplicationColumns() {
|
export default function ApplicationColumns() {
|
||||||
@@ -8,9 +8,8 @@ export default function ApplicationColumns() {
|
|||||||
accessorFn: (row) => {
|
accessorFn: (row) => {
|
||||||
if (row.id) {
|
if (row.id) {
|
||||||
return `${row.id}`;
|
return `${row.id}`;
|
||||||
} else {
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
},
|
},
|
||||||
enableEditing: false,
|
enableEditing: false,
|
||||||
id: "id",
|
id: "id",
|
||||||
@@ -27,9 +26,8 @@ export default function ApplicationColumns() {
|
|||||||
accessorFn: (row) => {
|
accessorFn: (row) => {
|
||||||
if (row.name) {
|
if (row.name) {
|
||||||
return `${row.name}`;
|
return `${row.name}`;
|
||||||
} else {
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
},
|
},
|
||||||
id: "name",
|
id: "name",
|
||||||
header: "Name",
|
header: "Name",
|
||||||
@@ -44,9 +42,8 @@ export default function ApplicationColumns() {
|
|||||||
accessorFn: (row) => {
|
accessorFn: (row) => {
|
||||||
if (row.url) {
|
if (row.url) {
|
||||||
return `${row.url}`;
|
return `${row.url}`;
|
||||||
} else {
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
},
|
},
|
||||||
id: "url",
|
id: "url",
|
||||||
header: "Url",
|
header: "Url",
|
||||||
@@ -61,9 +58,8 @@ export default function ApplicationColumns() {
|
|||||||
accessorFn: (row) => {
|
accessorFn: (row) => {
|
||||||
if (row.icon) {
|
if (row.icon) {
|
||||||
return `${row.icon}`;
|
return `${row.icon}`;
|
||||||
} else {
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
},
|
},
|
||||||
id: "icon",
|
id: "icon",
|
||||||
header: "Icon",
|
header: "Icon",
|
||||||
@@ -78,9 +74,8 @@ export default function ApplicationColumns() {
|
|||||||
accessorFn: (row) => {
|
accessorFn: (row) => {
|
||||||
if (row.urlbase) {
|
if (row.urlbase) {
|
||||||
return `${row.urlbase}`;
|
return `${row.urlbase}`;
|
||||||
} else {
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
},
|
},
|
||||||
id: "urlbase",
|
id: "urlbase",
|
||||||
header: "Base Url",
|
header: "Base Url",
|
||||||
@@ -95,9 +90,8 @@ export default function ApplicationColumns() {
|
|||||||
accessorFn: (row) => {
|
accessorFn: (row) => {
|
||||||
if (row.category) {
|
if (row.category) {
|
||||||
return `${row.category}`;
|
return `${row.category}`;
|
||||||
} else {
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
},
|
},
|
||||||
id: "category",
|
id: "category",
|
||||||
header: "Category",
|
header: "Category",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { MRT_ColumnDef } from "mantine-react-table";
|
import type { MRT_ColumnDef } from "mantine-react-table";
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
|
|
||||||
export default function ApplicationColumns(groups: any, groupData: any) {
|
export default function ApplicationColumns(groups: any, groupData: any) {
|
||||||
@@ -8,9 +8,8 @@ export default function ApplicationColumns(groups: any, groupData: any) {
|
|||||||
accessorFn: (row) => {
|
accessorFn: (row) => {
|
||||||
if (row.id) {
|
if (row.id) {
|
||||||
return `${row.id}`;
|
return `${row.id}`;
|
||||||
} else {
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
},
|
},
|
||||||
enableEditing: false,
|
enableEditing: false,
|
||||||
id: "id",
|
id: "id",
|
||||||
@@ -27,9 +26,8 @@ export default function ApplicationColumns(groups: any, groupData: any) {
|
|||||||
accessorFn: (row) => {
|
accessorFn: (row) => {
|
||||||
if (row.name) {
|
if (row.name) {
|
||||||
return `${row.name}`;
|
return `${row.name}`;
|
||||||
} else {
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
},
|
},
|
||||||
id: "name",
|
id: "name",
|
||||||
header: "Name",
|
header: "Name",
|
||||||
@@ -44,9 +42,8 @@ export default function ApplicationColumns(groups: any, groupData: any) {
|
|||||||
accessorFn: (row) => {
|
accessorFn: (row) => {
|
||||||
if (row.url) {
|
if (row.url) {
|
||||||
return `${row.url}`;
|
return `${row.url}`;
|
||||||
} else {
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
},
|
},
|
||||||
id: "url",
|
id: "url",
|
||||||
header: "Url",
|
header: "Url",
|
||||||
@@ -62,9 +59,8 @@ export default function ApplicationColumns(groups: any, groupData: any) {
|
|||||||
const index: number = row.category;
|
const index: number = row.category;
|
||||||
if (index !== null && index !== undefined) {
|
if (index !== null && index !== undefined) {
|
||||||
return `${index}`;
|
return `${index}`;
|
||||||
} else {
|
|
||||||
return "N/A";
|
|
||||||
}
|
}
|
||||||
|
return "N/A";
|
||||||
},
|
},
|
||||||
id: "category",
|
id: "category",
|
||||||
header: "Category",
|
header: "Category",
|
||||||
|
|||||||
67
src/DataTable/columns/CategoryColumns.tsx
Normal file
67
src/DataTable/columns/CategoryColumns.tsx
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
import type { MRT_ColumnDef } from "mantine-react-table";
|
||||||
|
import { useMemo } from "react";
|
||||||
|
|
||||||
|
export default function CategoryColumns() {
|
||||||
|
const columns = useMemo<MRT_ColumnDef<any>[]>(
|
||||||
|
() => [
|
||||||
|
{
|
||||||
|
accessorFn: (row) => {
|
||||||
|
if (row.id) {
|
||||||
|
return `${row.id}`;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
enableEditing: false,
|
||||||
|
id: "id",
|
||||||
|
header: "ID",
|
||||||
|
size: 50,
|
||||||
|
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||||
|
Header: ({ column }) => column.columnDef.header,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorFn: (row) => {
|
||||||
|
if (row.category_name) {
|
||||||
|
return `${row.category_name}`;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
id: "category_name",
|
||||||
|
header: "Name",
|
||||||
|
size: 50,
|
||||||
|
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||||
|
Header: ({ column }) => column.columnDef.header,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorFn: (row) => {
|
||||||
|
if (row.category_index > -1) {
|
||||||
|
return `${row.category_index}`;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
enableEditing: false,
|
||||||
|
id: "category_index",
|
||||||
|
header: "Index",
|
||||||
|
size: 50,
|
||||||
|
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||||
|
Header: ({ column }) => column.columnDef.header,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorFn: (row) => {
|
||||||
|
if (row.column_filter) {
|
||||||
|
return `${row.column_filter}`;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
id: "column_filter",
|
||||||
|
header: "Filter Name",
|
||||||
|
size: 50,
|
||||||
|
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||||
|
Header: ({ column }) => column.columnDef.header,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
|
return columns;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { MRT_ColumnDef } from "mantine-react-table";
|
import type { MRT_ColumnDef } from "mantine-react-table";
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
|
|
||||||
export default function MessagesColumns() {
|
export default function MessagesColumns() {
|
||||||
@@ -8,9 +8,8 @@ export default function MessagesColumns() {
|
|||||||
accessorFn: (row) => {
|
accessorFn: (row) => {
|
||||||
if (row.id) {
|
if (row.id) {
|
||||||
return `${row.id}`;
|
return `${row.id}`;
|
||||||
} else {
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
},
|
},
|
||||||
enableEditing: false,
|
enableEditing: false,
|
||||||
id: "id",
|
id: "id",
|
||||||
@@ -27,9 +26,8 @@ export default function MessagesColumns() {
|
|||||||
accessorFn: (row) => {
|
accessorFn: (row) => {
|
||||||
if (row.message) {
|
if (row.message) {
|
||||||
return `${row.message}`;
|
return `${row.message}`;
|
||||||
} else {
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
},
|
},
|
||||||
id: "message",
|
id: "message",
|
||||||
header: "Message",
|
header: "Message",
|
||||||
@@ -44,9 +42,8 @@ export default function MessagesColumns() {
|
|||||||
accessorFn: (row) => {
|
accessorFn: (row) => {
|
||||||
if (row.easteregg) {
|
if (row.easteregg) {
|
||||||
return `${row.easteregg}`;
|
return `${row.easteregg}`;
|
||||||
} else {
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
},
|
},
|
||||||
id: "easteregg",
|
id: "easteregg",
|
||||||
header: "Easter Egg?",
|
header: "Easter Egg?",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { MRT_ColumnDef } from "mantine-react-table";
|
import type { MRT_ColumnDef } from "mantine-react-table";
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
|
|
||||||
export default function PersonalizationColumns() {
|
export default function PersonalizationColumns() {
|
||||||
@@ -8,9 +8,8 @@ export default function PersonalizationColumns() {
|
|||||||
accessorFn: (row: any) => {
|
accessorFn: (row: any) => {
|
||||||
if (row.firstname) {
|
if (row.firstname) {
|
||||||
return `${row.firstname}`;
|
return `${row.firstname}`;
|
||||||
} else {
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
},
|
},
|
||||||
id: "firstname",
|
id: "firstname",
|
||||||
header: "First Name",
|
header: "First Name",
|
||||||
@@ -26,9 +25,8 @@ export default function PersonalizationColumns() {
|
|||||||
accessorFn: (row: any) => {
|
accessorFn: (row: any) => {
|
||||||
if (row.lastname) {
|
if (row.lastname) {
|
||||||
return `${row.lastname}`;
|
return `${row.lastname}`;
|
||||||
} else {
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
},
|
},
|
||||||
id: "lastname",
|
id: "lastname",
|
||||||
header: "Last Name",
|
header: "Last Name",
|
||||||
@@ -43,9 +41,8 @@ export default function PersonalizationColumns() {
|
|||||||
accessorFn: (row: any) => {
|
accessorFn: (row: any) => {
|
||||||
if (row.email) {
|
if (row.email) {
|
||||||
return `${row.email}`;
|
return `${row.email}`;
|
||||||
} else {
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
},
|
},
|
||||||
id: "email",
|
id: "email",
|
||||||
header: "Email",
|
header: "Email",
|
||||||
|
|||||||
63
src/DataTable/columns/SearchProviderColumns.tsx
Normal file
63
src/DataTable/columns/SearchProviderColumns.tsx
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
import type { MRT_ColumnDef } from "mantine-react-table";
|
||||||
|
import { useMemo } from "react";
|
||||||
|
|
||||||
|
export default function SearchProviderColumns() {
|
||||||
|
const columns = useMemo<MRT_ColumnDef<any>[]>(
|
||||||
|
() => [
|
||||||
|
{
|
||||||
|
accessorFn: (row) => {
|
||||||
|
if (row.id) {
|
||||||
|
return `${row.id}`;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
enableEditing: false,
|
||||||
|
id: "id",
|
||||||
|
header: "ID",
|
||||||
|
size: 50,
|
||||||
|
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||||
|
Header: ({ column }) => column.columnDef.header,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorFn: (row) => {
|
||||||
|
if (row.name) {
|
||||||
|
return `${row.name}`;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
id: "name",
|
||||||
|
header: "Name",
|
||||||
|
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||||
|
Header: ({ column }) => column.columnDef.header,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorFn: (row) => {
|
||||||
|
if (row.url) {
|
||||||
|
return `${row.url}`;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
id: "url",
|
||||||
|
header: "Url",
|
||||||
|
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||||
|
Header: ({ column }) => column.columnDef.header,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorFn: (row) => {
|
||||||
|
if (row.prefix) {
|
||||||
|
return `${row.prefix}`;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
id: "prefix",
|
||||||
|
header: "Prefix",
|
||||||
|
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||||
|
Header: ({ column }) => column.columnDef.header,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
|
return columns;
|
||||||
|
}
|
||||||
|
|
||||||
11
src/components/ThemeProvider.tsx
Normal file
11
src/components/ThemeProvider.tsx
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { Box } from '@mantine/core';
|
||||||
|
|
||||||
|
export default function ThemeProvider({ theme, children }: { theme: any, children: React.ReactNode }) {
|
||||||
|
return <Box style={{
|
||||||
|
'--color-text-pri': theme.colortextpri,
|
||||||
|
'--color-text-acc': theme.colortextacc,
|
||||||
|
'--color-background': theme.colorbackground,
|
||||||
|
'--color-border': theme.colorborder,
|
||||||
|
'--color-search-background': theme.colorsearchbackground,
|
||||||
|
}}>{children}</Box>;
|
||||||
|
}
|
||||||
@@ -1,78 +1 @@
|
|||||||
@import url('https://fonts.googleapis.com/css2?family=Jost:ital,wght@0,100;0,200;0,400;1,100;1,200&display=swap');
|
@import url('https://fonts.googleapis.com/css2?family=Jost:ital,wght@0,100;0,200;0,400;1,100;1,200&display=swap');
|
||||||
|
|
||||||
:root {
|
|
||||||
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
||||||
line-height: 1.5;
|
|
||||||
font-weight: 400;
|
|
||||||
|
|
||||||
color-scheme: light dark;
|
|
||||||
color: rgba(255, 255, 255, 0.87);
|
|
||||||
background-color: #242424;
|
|
||||||
|
|
||||||
font-synthesis: none;
|
|
||||||
text-rendering: optimizeLegibility;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
font-weight: 500;
|
|
||||||
color: #646cff;
|
|
||||||
text-decoration: inherit;
|
|
||||||
}
|
|
||||||
a:hover {
|
|
||||||
color: #535bf2;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
display: flex;
|
|
||||||
place-items: center;
|
|
||||||
min-width: 320px;
|
|
||||||
min-height: 100vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 3.2em;
|
|
||||||
line-height: 1.1;
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
|
||||||
border-radius: 8px;
|
|
||||||
border: 1px solid transparent;
|
|
||||||
padding: 0.6em 1.2em;
|
|
||||||
font-size: 1em;
|
|
||||||
font-weight: 500;
|
|
||||||
font-family: inherit;
|
|
||||||
background-color: #1a1a1a;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: border-color 0.25s;
|
|
||||||
}
|
|
||||||
button:hover {
|
|
||||||
border-color: #646cff;
|
|
||||||
}
|
|
||||||
button:focus,
|
|
||||||
button:focus-visible {
|
|
||||||
outline: 4px auto -webkit-focus-ring-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
#settings-container {
|
|
||||||
justify-content: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
#settings-nav {
|
|
||||||
width: 25vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-color-scheme: light) {
|
|
||||||
:root {
|
|
||||||
color: #213547;
|
|
||||||
background-color: #ffffff;
|
|
||||||
}
|
|
||||||
a:hover {
|
|
||||||
color: #747bff;
|
|
||||||
}
|
|
||||||
button {
|
|
||||||
background-color: #f9f9f9;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
14
src/main.tsx
14
src/main.tsx
@@ -1,10 +1,22 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import ReactDOM from 'react-dom/client'
|
import ReactDOM from 'react-dom/client'
|
||||||
import App from './App.tsx'
|
import App from './App.tsx'
|
||||||
import './index.css'
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||||
|
|
||||||
|
const queryClient = new QueryClient({
|
||||||
|
defaultOptions: {
|
||||||
|
queries: {
|
||||||
|
gcTime: 1000 * 60 * 60 * 24, // 24 hours
|
||||||
|
staleTime: 1000 * 60 * 1, // 1 min
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
ReactDOM.createRoot(document.getElementById('root')!).render(
|
ReactDOM.createRoot(document.getElementById('root')!).render(
|
||||||
|
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
|
<QueryClientProvider client={queryClient}>
|
||||||
<App />
|
<App />
|
||||||
|
</QueryClientProvider>
|
||||||
</React.StrictMode>,
|
</React.StrictMode>,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -6,16 +6,14 @@ import Header from './components/Header';
|
|||||||
import Applications from './components/Applications';
|
import Applications from './components/Applications';
|
||||||
import Bookmarks from './components/Bookmarks';
|
import Bookmarks from './components/Bookmarks';
|
||||||
import SettingsButton from './components/SettingsButton';
|
import SettingsButton from './components/SettingsButton';
|
||||||
import { useAtom } from 'jotai';
|
|
||||||
import { HomepageFilters } from '../../contexts/HomepageFilters';
|
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
import '../../index.css';
|
||||||
|
import { useLocalStorage } from '@mantine/hooks';
|
||||||
|
|
||||||
|
export default function Homepage({theme}:any) {
|
||||||
export default function Homepage() {
|
|
||||||
const { data, isFetching } = useQueryAPI({ endpoint: 'api/messages' });
|
const { data, isFetching } = useQueryAPI({ endpoint: 'api/messages' });
|
||||||
const [displayedGreeting, setDisplayedGreeting] = useState('');
|
const [displayedGreeting, setDisplayedGreeting] = useState('');
|
||||||
const [homepageFilter, setHomepageFilter] = useAtom<any>(HomepageFilters);
|
const [contentType, setContentType] = useLocalStorage<any>({ key: 'contenttype', defaultValue: 'All' });
|
||||||
|
|
||||||
function date() {
|
function date() {
|
||||||
const currentDate = new Date();
|
const currentDate = new Date();
|
||||||
const dateOptions: Intl.DateTimeFormatOptions = {
|
const dateOptions: Intl.DateTimeFormatOptions = {
|
||||||
@@ -27,7 +25,6 @@ export default function Homepage() {
|
|||||||
const date = currentDate.toLocaleDateString('en-GB', dateOptions);
|
const date = currentDate.toLocaleDateString('en-GB', dateOptions);
|
||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
|
|
||||||
function greet(list: any) {
|
function greet(list: any) {
|
||||||
const currentTime = new Date();
|
const currentTime = new Date();
|
||||||
const greet = Math.floor(currentTime.getHours() / 6);
|
const greet = Math.floor(currentTime.getHours() / 6);
|
||||||
@@ -54,12 +51,12 @@ export default function Homepage() {
|
|||||||
}, [isFetching]);
|
}, [isFetching]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack className={stackClasses.containerStack}>
|
<Stack gap={0} className={stackClasses.containerStack} justify='center'>
|
||||||
<Search />
|
<Search />
|
||||||
<Header date={date()} greet={displayedGreeting} />
|
<Header date={date()} greet={displayedGreeting} />
|
||||||
<Applications />
|
<Applications contentType={contentType}/>
|
||||||
<Bookmarks />
|
<Bookmarks contentType={contentType}/>
|
||||||
<SettingsButton />
|
<SettingsButton theme={theme} contentType={contentType} setContentType={setContentType}/>
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,16 +4,14 @@ import {useQueryAPI} from '../../../hooks/useAPI';
|
|||||||
import texts from '../../../styles/Text.module.css';
|
import texts from '../../../styles/Text.module.css';
|
||||||
import AppItem from './AppItem';
|
import AppItem from './AppItem';
|
||||||
|
|
||||||
function Applications() {
|
function Applications({contentType}: any) {
|
||||||
const { data, isFetching } = useQueryAPI({ endpoint: 'api/apps' });
|
const { data, isFetching } = useQueryAPI({ endpoint: 'api/apps' });
|
||||||
const [applications, setApplications] = useState([]);
|
const [applications, setApplications] = useState([]);
|
||||||
const contentType = localStorage.getItem('contenttype');
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isFetching) {
|
if (!isFetching) {
|
||||||
setApplications(data);
|
setApplications(data);
|
||||||
}
|
}
|
||||||
}, [isFetching]);
|
}, [isFetching]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack id='apps' style={{ gap: 0 }}>
|
<Stack id='apps' style={{ gap: 0 }}>
|
||||||
<Text className={texts.sectionTitle} classNames={texts}>Applications</Text>
|
<Text className={texts.sectionTitle} classNames={texts}>Applications</Text>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {useQueryAPI} from '../../../hooks/useAPI';
|
|||||||
import texts from '../../../styles/Text.module.css';
|
import texts from '../../../styles/Text.module.css';
|
||||||
import LinkGroups from './LinkGroups';
|
import LinkGroups from './LinkGroups';
|
||||||
|
|
||||||
function Links() {
|
function Links({contentType}: any) {
|
||||||
const { data: linkData, isFetched: linksIsFetched } = useQueryAPI({
|
const { data: linkData, isFetched: linksIsFetched } = useQueryAPI({
|
||||||
endpoint: 'api/links',
|
endpoint: 'api/links',
|
||||||
});
|
});
|
||||||
@@ -38,8 +38,8 @@ function Links() {
|
|||||||
>
|
>
|
||||||
{categories.map((category: any) => {
|
{categories.map((category: any) => {
|
||||||
if (
|
if (
|
||||||
category.column_filter === localStorage.getItem('contenttype') ||
|
category.column_filter === contentType ||
|
||||||
localStorage.getItem('contenttype') === 'All'
|
contentType === 'All'
|
||||||
) {
|
) {
|
||||||
return (
|
return (
|
||||||
<LinkGroups
|
<LinkGroups
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ function Header({ greet, date }: any) {
|
|||||||
float: 'right',
|
float: 'right',
|
||||||
justifyContent: 'right',
|
justifyContent: 'right',
|
||||||
width: 'auto',
|
width: 'auto',
|
||||||
|
gap: 0,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text className={textClasses.dateTime} classNames={textClasses} style={{ width: 'max-content' }}>
|
<Text className={textClasses.dateTime} classNames={textClasses} style={{ width: 'max-content' }}>
|
||||||
|
|||||||
@@ -53,10 +53,10 @@ export default function Search() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<TextInput
|
<TextInput
|
||||||
className={textInputClasses.keyword}
|
className={textInputClasses.search}
|
||||||
classNames={textInputClasses}
|
classNames={textInputClasses}
|
||||||
spellCheck='true'
|
spellCheck='true'
|
||||||
label={providerLabel}
|
leftSection={providerLabel}
|
||||||
onChange={(item: any) => {
|
onChange={(item: any) => {
|
||||||
if(item.target.value.startsWith('/')) {
|
if(item.target.value.startsWith('/')) {
|
||||||
setProviderLabel(providers?.find((p: any) => p.prefix === item.target.value.split(' ')[0]).name);
|
setProviderLabel(providers?.find((p: any) => p.prefix === item.target.value.split(' ')[0]).name);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Button, Menu, NavLink, Select, Stack } from '@mantine/core';
|
import { Button, Menu, NavLink, Select } from '@mantine/core';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { FiMenu, FiMonitor } from 'react-icons/fi';
|
import { FiMenu, FiMonitor } from 'react-icons/fi';
|
||||||
import {useQueryAPI} from '../../../hooks/useAPI';
|
import {useQueryAPI} from '../../../hooks/useAPI';
|
||||||
@@ -6,25 +6,14 @@ import button from '../../../styles/Button.module.css';
|
|||||||
import menu from '../../../styles/Menu.module.css';
|
import menu from '../../../styles/Menu.module.css';
|
||||||
import navLink from '../../../styles/NavLink.module.css';
|
import navLink from '../../../styles/NavLink.module.css';
|
||||||
import selectClasses from '../../../styles/Select.module.css';
|
import selectClasses from '../../../styles/Select.module.css';
|
||||||
import { useAtom } from 'jotai';
|
|
||||||
import { HomepageFilters } from '../../../contexts/HomepageFilters';
|
|
||||||
|
|
||||||
function SettingsButton() {
|
function SettingsButton({contentType, setContentType, theme}: any) {
|
||||||
const { data, isFetched } = useQueryAPI({ endpoint: 'api/appCategories' });
|
const { data, isFetched } = useQueryAPI({ endpoint: 'api/appCategories' });
|
||||||
const [categories, setCategories] = useState([{value: 'All', label: 'All'}]);
|
const [categories, setCategories] = useState([{value: 'All', label: 'All'}]);
|
||||||
const [homepageFilter, setHomepageFilter] = useAtom<object>(HomepageFilters);
|
|
||||||
const classNames = {
|
|
||||||
root: navLink.root,
|
|
||||||
body: navLink.body,
|
|
||||||
section: navLink.section,
|
|
||||||
label: navLink.label,
|
|
||||||
description: navLink.description,
|
|
||||||
chevron: navLink.chevron,
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if(data) {
|
if(data) {
|
||||||
let list: [any] = data.map((category: any) => {return {value: category.category, label: category.category}}) || [];
|
const list: [any] = data.map((category: any) => {return {value: category.category, label: category.category}}) || [];
|
||||||
list.unshift({value: 'All', label: 'All'});
|
list.unshift({value: 'All', label: 'All'});
|
||||||
setCategories(list);
|
setCategories(list);
|
||||||
}
|
}
|
||||||
@@ -39,18 +28,10 @@ function SettingsButton() {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Menu
|
<Menu
|
||||||
withinPortal
|
withinPortal={false}
|
||||||
withArrow
|
withArrow
|
||||||
shadow='md'
|
shadow='md'
|
||||||
position='top'
|
position='top'
|
||||||
classNames={{
|
|
||||||
dropdown: menu.dropdown
|
|
||||||
}}
|
|
||||||
styles={{
|
|
||||||
dropdown: {
|
|
||||||
backgroundColor: 'var(--color-background)',
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<Menu.Target>
|
<Menu.Target>
|
||||||
<Button className={button.settingsButton} classNames={button}>
|
<Button className={button.settingsButton} classNames={button}>
|
||||||
@@ -58,40 +39,36 @@ function SettingsButton() {
|
|||||||
</Button>
|
</Button>
|
||||||
</Menu.Target>
|
</Menu.Target>
|
||||||
<Menu.Dropdown
|
<Menu.Dropdown
|
||||||
style={{
|
className={menu.dropdown}
|
||||||
position: 'absolute',
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<NavLink
|
<NavLink
|
||||||
label='Settings'
|
label='Settings'
|
||||||
component='a'
|
component='a'
|
||||||
href='/trigger/settings'
|
href='/trigger/settings'
|
||||||
classNames={classNames}
|
className={navLink.defaultNavLink}
|
||||||
|
classNames={navLink}
|
||||||
/>
|
/>
|
||||||
<NavLink label='Quick Actions' classNames={classNames}>
|
<NavLink label='Quick Actions'
|
||||||
|
className={navLink.defaultNavLink}
|
||||||
|
classNames={navLink}>
|
||||||
<NavLink
|
<NavLink
|
||||||
label='Wake Dakota'
|
label='Wake Dakota'
|
||||||
leftSection={<FiMonitor />}
|
leftSection={<FiMonitor />}
|
||||||
onClick={() => runWakeCommand()}
|
onClick={() => runWakeCommand()}
|
||||||
classNames={classNames}
|
className={navLink.defaultNavLink}
|
||||||
|
classNames={navLink}
|
||||||
/>
|
/>
|
||||||
</NavLink>
|
</NavLink>
|
||||||
<Select
|
<Select
|
||||||
label='Homepage Filter'
|
label='Homepage Filter'
|
||||||
data={categories ?? []}
|
data={categories ?? []}
|
||||||
defaultValue={localStorage.getItem('contenttype')}
|
defaultValue={contentType}
|
||||||
withCheckIcon={false}
|
withCheckIcon={false}
|
||||||
onChange={(data: any) => {
|
onChange={(data: any) => {
|
||||||
localStorage.setItem('contenttype', data || 'All');
|
setContentType(data)
|
||||||
setHomepageFilter({value: data, label: data});
|
|
||||||
}}
|
}}
|
||||||
className={selectClasses.filterSelect}
|
|
||||||
classNames={selectClasses}
|
classNames={selectClasses}
|
||||||
styles={{
|
comboboxProps={{ withinPortal: false }}
|
||||||
label: {
|
|
||||||
color: 'var(--color-text-pri)',
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</Menu.Dropdown>
|
</Menu.Dropdown>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
|||||||
@@ -6,31 +6,34 @@ import { actionIconClasses } from "../../styles";
|
|||||||
import Messages from "./components/Messages";
|
import Messages from "./components/Messages";
|
||||||
import Applications from "./components/Applications";
|
import Applications from "./components/Applications";
|
||||||
import Bookmarks from "./components/Bookmarks";
|
import Bookmarks from "./components/Bookmarks";
|
||||||
|
import Categories from "./components/Categories";
|
||||||
|
import SearchProviders from "./components/SearchProviders";
|
||||||
|
import Themes from "./components/Themes";
|
||||||
|
|
||||||
function Settings() {
|
function Settings({theme}:any) {
|
||||||
return (
|
return (
|
||||||
<Stack h={'100vh'} px={'2rem'}>
|
<Stack h={'100vh'} px={'2rem'} bg={'var(--color-background)'}>
|
||||||
<Group gap={0} >
|
<Group gap={0} >
|
||||||
<ActionIcon className={actionIconClasses.backButton} classNames={actionIconClasses} component="a" href="/trigger"><FiArrowLeftCircle/></ActionIcon>
|
<ActionIcon className={actionIconClasses.backButton} classNames={actionIconClasses} component="a" href="/trigger"><FiArrowLeftCircle/></ActionIcon>
|
||||||
<h1>Settings</h1>
|
<h1>Settings</h1>
|
||||||
</Group>
|
</Group>
|
||||||
<Tabs keepMounted orientation="vertical" defaultValue={'personalization'} className={tabClasses.settingsTabs} classNames={tabClasses}>
|
<Tabs orientation="vertical" defaultValue={'personalization'} className={tabClasses.settingsTabs} classNames={tabClasses}>
|
||||||
<Tabs.List>
|
<Tabs.List>
|
||||||
<Tabs.Tab value="personalization">Personal Info</Tabs.Tab>
|
<Tabs.Tab value="personalization">Personal Info</Tabs.Tab>
|
||||||
<Tabs.Tab value="messages">Messages</Tabs.Tab>
|
<Tabs.Tab value="messages">Messages</Tabs.Tab>
|
||||||
<Tabs.Tab value="applications">Applications</Tabs.Tab>
|
<Tabs.Tab value="applications">Applications</Tabs.Tab>
|
||||||
<Tabs.Tab value="bookmarksCategories">Bookmark Categories</Tabs.Tab>
|
|
||||||
<Tabs.Tab value="bookmarks">Bookmarks</Tabs.Tab>
|
<Tabs.Tab value="bookmarks">Bookmarks</Tabs.Tab>
|
||||||
|
<Tabs.Tab value="bookmarksCategories">Categories</Tabs.Tab>
|
||||||
<Tabs.Tab value="themes">Themes</Tabs.Tab>
|
<Tabs.Tab value="themes">Themes</Tabs.Tab>
|
||||||
<Tabs.Tab value="providers">Search Providers</Tabs.Tab>
|
<Tabs.Tab value="providers">Search Providers</Tabs.Tab>
|
||||||
</Tabs.List>
|
</Tabs.List>
|
||||||
<Tabs.Panel value="personalization"><Personalization/></Tabs.Panel>
|
<Tabs.Panel value="personalization"><Personalization/></Tabs.Panel>
|
||||||
<Tabs.Panel value="messages"><Messages/></Tabs.Panel>
|
<Tabs.Panel value="messages"><Messages/></Tabs.Panel>
|
||||||
<Tabs.Panel value="applications"><Applications/></Tabs.Panel>
|
<Tabs.Panel value="applications"><Applications/></Tabs.Panel>
|
||||||
<Tabs.Panel value="bookmarksCategories">Bookmark Categories</Tabs.Panel>
|
|
||||||
<Tabs.Panel value="bookmarks"><Bookmarks/></Tabs.Panel>
|
<Tabs.Panel value="bookmarks"><Bookmarks/></Tabs.Panel>
|
||||||
<Tabs.Panel value="themes">Themes</Tabs.Panel>
|
<Tabs.Panel value="bookmarksCategories"><Categories/></Tabs.Panel>
|
||||||
<Tabs.Panel value="providers">Search Providers</Tabs.Panel>
|
<Tabs.Panel value="themes"><Themes/></Tabs.Panel>
|
||||||
|
<Tabs.Panel value="providers"><SearchProviders/></Tabs.Panel>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { useEffect, useState } from "react";
|
|||||||
import {useMutationAPI, useQueryAPI} from "../../../hooks/useAPI";
|
import {useMutationAPI, useQueryAPI} from "../../../hooks/useAPI";
|
||||||
import { DataTable } from "../../../DataTable/DataTable";
|
import { DataTable } from "../../../DataTable/DataTable";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
import { MRT_TableOptions } from "mantine-react-table";
|
import type { MRT_TableOptions } from "mantine-react-table";
|
||||||
import ApplicationColumns from "../../../DataTable/columns/ApplicationColumns";
|
import ApplicationColumns from "../../../DataTable/columns/ApplicationColumns";
|
||||||
import { Stack } from "@mantine/core";
|
import { Stack } from "@mantine/core";
|
||||||
const ApplicationSettings = () => {
|
const ApplicationSettings = () => {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { useEffect, useState } from "react";
|
|||||||
import {useMutationAPI, useQueryAPI} from "../../../hooks/useAPI";
|
import {useMutationAPI, useQueryAPI} from "../../../hooks/useAPI";
|
||||||
import { DataTable } from "../../../DataTable/DataTable";
|
import { DataTable } from "../../../DataTable/DataTable";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
import { MRT_TableOptions } from "mantine-react-table";
|
import type { MRT_TableOptions } from "mantine-react-table";
|
||||||
import { Stack } from "@mantine/core";
|
import { Stack } from "@mantine/core";
|
||||||
import BookmarkColumns from "../../../DataTable/columns/BookmarkColumns";
|
import BookmarkColumns from "../../../DataTable/columns/BookmarkColumns";
|
||||||
const BookmarkSettings = () => {
|
const BookmarkSettings = () => {
|
||||||
@@ -30,7 +30,7 @@ const BookmarkSettings = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (groupDataisFetched) {
|
if (groupDataisFetched) {
|
||||||
let groupList = groupData.map((category: any) => {
|
const groupList = groupData.map((category: any) => {
|
||||||
return category.category_name;
|
return category.category_name;
|
||||||
});
|
});
|
||||||
setGroups(groupList);
|
setGroups(groupList);
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import {useMutationAPI, useQueryAPI} from "../../../hooks/useAPI";
|
||||||
|
import { DataTable } from "../../../DataTable/DataTable";
|
||||||
|
import { toast } from "react-toastify";
|
||||||
|
import type { MRT_TableOptions } from "mantine-react-table";
|
||||||
|
import CategoryColumns from "../../../DataTable/columns/CategoryColumns";
|
||||||
|
import { Stack } from "@mantine/core";
|
||||||
|
const CategorySettings = () => {
|
||||||
|
const endpoint = "api/categories";
|
||||||
|
const { data, isFetching, isLoading, isFetched } = useQueryAPI({
|
||||||
|
endpoint: endpoint,
|
||||||
|
});
|
||||||
|
const [categoryData, setCategoryData] = useState<any>([]);
|
||||||
|
|
||||||
|
const {mutateAsync: createRow, isPending: isCreatingRow} = useMutationAPI();
|
||||||
|
const {mutateAsync: editRow, isPending: isEditingRow} = useMutationAPI();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if(isFetched) {
|
||||||
|
setCategoryData(data);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const handleCreateRow: MRT_TableOptions<any>['onCreatingRowSave'] = async ({
|
||||||
|
values,
|
||||||
|
exitCreatingMode,
|
||||||
|
}) => {
|
||||||
|
|
||||||
|
createRow({method: "POST", endpoint: endpoint, body: values}).then(() => {
|
||||||
|
toast.success("Category created successfully");
|
||||||
|
})
|
||||||
|
exitCreatingMode();
|
||||||
|
};
|
||||||
|
const handleEditRow: MRT_TableOptions<any>['onCreatingRowSave'] = async ({
|
||||||
|
values,
|
||||||
|
table,
|
||||||
|
}) => {
|
||||||
|
editRow({method: "PATCH", endpoint: endpoint, body: values}).then(() => {
|
||||||
|
toast.success("Category updated successfully");
|
||||||
|
});
|
||||||
|
table.setEditingRow(null);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Stack>
|
||||||
|
<h2>Categories</h2>
|
||||||
|
<DataTable
|
||||||
|
tableName="Categories"
|
||||||
|
columns={CategoryColumns()}
|
||||||
|
tableData={categoryData}
|
||||||
|
isFetching={isFetching}
|
||||||
|
isLoading={isLoading}
|
||||||
|
onCreatingRowSave={handleCreateRow}
|
||||||
|
onEditingRowSave={handleEditRow}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
)
|
||||||
|
};
|
||||||
|
export default CategorySettings;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { useEffect, useState } from "react";
|
|||||||
import {useMutationAPI, useQueryAPI} from "../../../hooks/useAPI";
|
import {useMutationAPI, useQueryAPI} from "../../../hooks/useAPI";
|
||||||
import { DataTable } from "../../../DataTable/DataTable";
|
import { DataTable } from "../../../DataTable/DataTable";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
import { MRT_TableOptions } from "mantine-react-table";
|
import type { MRT_TableOptions } from "mantine-react-table";
|
||||||
import MessagesColumns from "../../../DataTable/columns/MessagesColumns";
|
import MessagesColumns from "../../../DataTable/columns/MessagesColumns";
|
||||||
import { Stack } from "@mantine/core";
|
import { Stack } from "@mantine/core";
|
||||||
const MessageSettings = () => {
|
const MessageSettings = () => {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {useMutationAPI, useQueryAPI} from "../../../hooks/useAPI";
|
|||||||
import { DataTable } from "../../../DataTable/DataTable";
|
import { DataTable } from "../../../DataTable/DataTable";
|
||||||
import PersonalizationColumns from "../../../DataTable/columns/PersonalizationColumns";
|
import PersonalizationColumns from "../../../DataTable/columns/PersonalizationColumns";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
import { MRT_TableOptions } from "mantine-react-table";
|
import type { MRT_TableOptions } from "mantine-react-table";
|
||||||
const PersonalizationSettings = () => {
|
const PersonalizationSettings = () => {
|
||||||
const endpoint = "api/personaldata";
|
const endpoint = "api/personaldata";
|
||||||
const { data, isFetching, isLoading, isFetched } = useQueryAPI({
|
const { data, isFetching, isLoading, isFetched } = useQueryAPI({
|
||||||
|
|||||||
59
src/pages/settings/components/SearchProviders.tsx
Normal file
59
src/pages/settings/components/SearchProviders.tsx
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import {useMutationAPI, useQueryAPI} from "../../../hooks/useAPI";
|
||||||
|
import { DataTable } from "../../../DataTable/DataTable";
|
||||||
|
import { toast } from "react-toastify";
|
||||||
|
import type { MRT_TableOptions } from "mantine-react-table";
|
||||||
|
import SearchProviderColumns from "../../../DataTable/columns/SearchProviderColumns";
|
||||||
|
import { Stack } from "@mantine/core";
|
||||||
|
const SearchProviderSettings = () => {
|
||||||
|
const endpoint = "api/providers";
|
||||||
|
const { data, isFetching, isLoading, isFetched } = useQueryAPI({
|
||||||
|
endpoint: endpoint,
|
||||||
|
});
|
||||||
|
const [providerData, setProviderData] = useState<any>([]);
|
||||||
|
|
||||||
|
const {mutateAsync: createRow, isPending: isCreatingRow} = useMutationAPI();
|
||||||
|
const {mutateAsync: editRow, isPending: isEditingRow} = useMutationAPI();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if(isFetched) {
|
||||||
|
setProviderData(data);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const handleCreateRow: MRT_TableOptions<any>['onCreatingRowSave'] = async ({
|
||||||
|
values,
|
||||||
|
exitCreatingMode,
|
||||||
|
}) => {
|
||||||
|
|
||||||
|
createRow({method: "POST", endpoint: endpoint, body: values}).then(() => {
|
||||||
|
toast.success("Search provider created successfully");
|
||||||
|
})
|
||||||
|
exitCreatingMode();
|
||||||
|
};
|
||||||
|
const handleEditRow: MRT_TableOptions<any>['onCreatingRowSave'] = async ({
|
||||||
|
values,
|
||||||
|
table,
|
||||||
|
}) => {
|
||||||
|
editRow({method: "PATCH", endpoint: endpoint, body: values}).then(() => {
|
||||||
|
toast.success("Search provider updated successfully");
|
||||||
|
});
|
||||||
|
table.setEditingRow(null);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Stack>
|
||||||
|
<h2>Search Providers</h2>
|
||||||
|
<DataTable
|
||||||
|
tableName="Categories"
|
||||||
|
columns={SearchProviderColumns()}
|
||||||
|
tableData={providerData}
|
||||||
|
isFetching={isFetching}
|
||||||
|
isLoading={isLoading}
|
||||||
|
onCreatingRowSave={handleCreateRow}
|
||||||
|
onEditingRowSave={handleEditRow}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
)
|
||||||
|
};
|
||||||
|
export default SearchProviderSettings;
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { useQueryAPI } from "../../../hooks/useAPI";
|
||||||
|
import { ActionIcon, Button, ColorPicker, ColorSwatch, Group, Modal, SimpleGrid, Stack } from "@mantine/core";
|
||||||
|
import AppItem from "../../homepage/components/AppItem";
|
||||||
|
import { FiEdit } from "react-icons/fi";
|
||||||
|
import { useDisclosure, useLocalStorage } from "@mantine/hooks";
|
||||||
|
import '@mantine/core/styles/ModalBase.css';
|
||||||
|
import '@mantine/core/styles/Modal.css';
|
||||||
|
function ThemesSettings() {
|
||||||
|
const [opened, { open, close }] = useDisclosure(false);
|
||||||
|
const [value, setValue] = useLocalStorage<any>({ key: 'theme', defaultValue: {} });
|
||||||
|
const { data, isFetched } = useQueryAPI({
|
||||||
|
endpoint: "api/themes",
|
||||||
|
});
|
||||||
|
const [themesList, setThemesList] = useState([]);
|
||||||
|
const [selectedTheme, setSelectedTheme] = useState<any>({});
|
||||||
|
useEffect(() => {
|
||||||
|
if (isFetched) {
|
||||||
|
setThemesList(data);
|
||||||
|
}
|
||||||
|
}, [isFetched]);
|
||||||
|
|
||||||
|
const handleOpen = (theme: any) => {
|
||||||
|
setSelectedTheme(theme);
|
||||||
|
open();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Modal.Root opened={opened} onClose={close}>
|
||||||
|
<Modal.Overlay />
|
||||||
|
<Modal.Content>
|
||||||
|
<Modal.Header>
|
||||||
|
<Modal.Title>Edit Theme</Modal.Title>
|
||||||
|
<Modal.CloseButton />
|
||||||
|
</Modal.Header>
|
||||||
|
<Modal.Body>
|
||||||
|
<Stack style={{ backgroundColor: selectedTheme.colorbackground, borderRadius: '10px' }}>
|
||||||
|
<Group justify="center" style={{ color: selectedTheme.colortextpri }}>{selectedTheme.name}</Group>
|
||||||
|
<AppItem
|
||||||
|
name={'Example App'}
|
||||||
|
url={'https://example.com'}
|
||||||
|
icon={'mdi:apps'}
|
||||||
|
category={'Default'}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</Modal.Body>
|
||||||
|
</Modal.Content>
|
||||||
|
</Modal.Root>
|
||||||
|
<Stack h={'100%'} w={'100%'}>
|
||||||
|
<h2>Themes</h2>
|
||||||
|
<SimpleGrid cols={5}>
|
||||||
|
{themesList.map((theme: any) => (
|
||||||
|
<Stack key={theme.name}>
|
||||||
|
<Button
|
||||||
|
style={{
|
||||||
|
backgroundColor: theme.colorbackground,
|
||||||
|
border: `solid ${theme.colorborder}`,
|
||||||
|
color: theme.colortextpri,
|
||||||
|
}}
|
||||||
|
data-theme={theme.name}
|
||||||
|
onClick={() => {
|
||||||
|
setValue(theme.name)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{theme.name}
|
||||||
|
</Button>
|
||||||
|
<Group justify="space-between">
|
||||||
|
<Group className="theme-palette">
|
||||||
|
<ColorSwatch color={theme.colorbackground} />
|
||||||
|
<ColorSwatch color={theme.colorsearchbackground} />
|
||||||
|
<ColorSwatch color={theme.colortextpri} />
|
||||||
|
<ColorSwatch color={theme.colortextacc} />
|
||||||
|
<ColorSwatch color={theme.colorborder} />
|
||||||
|
</Group>
|
||||||
|
<ActionIcon
|
||||||
|
onClick={() => handleOpen(theme)}
|
||||||
|
><FiEdit/></ActionIcon>
|
||||||
|
</Group>
|
||||||
|
</Stack>
|
||||||
|
))}
|
||||||
|
</SimpleGrid>
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export default ThemesSettings;
|
||||||
|
|||||||
@@ -12,6 +12,11 @@
|
|||||||
border-radius: 100%;
|
border-radius: 100%;
|
||||||
border: solid 2px var(--color-text-pri);
|
border: solid 2px var(--color-text-pri);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
|
}
|
||||||
|
&:hover {
|
||||||
|
background-color: var(--color-background) !important;
|
||||||
|
color: var(--color-text-pri) !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
.settingsButton {
|
.dropdown {
|
||||||
.dropdown {
|
color: var(--color-text-pri);
|
||||||
background-color: white;
|
}
|
||||||
border: solid 2px var(--color-border);
|
.item {
|
||||||
border-color: var(--color-border);
|
&:hover {
|
||||||
|
background-color: var(--color-text-pri);
|
||||||
|
color: var(--color-background)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,22 +1,22 @@
|
|||||||
.root {
|
.defaultNavLink {
|
||||||
|
&.root {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding-left: 0px;
|
|
||||||
padding-right: 0px;
|
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
color: var(--color-text-pri);
|
color: var(--color-text-pri);
|
||||||
background-color: var(--color-background);
|
background-color: var(--color-background);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.root:hover {
|
&.root:hover {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
color: var(--color-background);
|
color: var(--color-background);
|
||||||
background-color: var(--color-text-acc);
|
background-color: var(--color-text-acc);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chevron {
|
&.chevron {
|
||||||
width: 10px !important;
|
width: 10px !important;
|
||||||
height: 10px !important;
|
height: 10px !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,34 @@
|
|||||||
.filterSelect {
|
.label {
|
||||||
.section {
|
margin-bottom: 5px !important;
|
||||||
display: none;
|
color: light-dark(var(--mantine-color-appGray-8), white) !important;
|
||||||
|
font-size: 14px !important;
|
||||||
|
}
|
||||||
|
.input {
|
||||||
|
border-color: light-dark(var(--mantine-color-appGray-2), white) !important;
|
||||||
|
background-color: var(--color-background);
|
||||||
|
color: var(--color-text-pri) !important;
|
||||||
|
&:focus {
|
||||||
|
border-color: var(--color-text-pri) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.options {
|
||||||
|
.option {
|
||||||
|
color: var(--color-text-pri) !important;
|
||||||
|
font-size: 14px !important;
|
||||||
|
/* applies styles to selected item */
|
||||||
|
&[data-checked] {
|
||||||
|
background-color: var(--color-text-pri) !important;
|
||||||
|
&, &:hover {
|
||||||
|
background-color: var(--color-text-acc) !important;
|
||||||
|
color: white !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* applies styles to hovered item (with mouse or keyboard) */
|
||||||
|
&:hover {
|
||||||
|
background-color: var(--color-text-acc) !important;
|
||||||
|
color: var(--color-text-pri) !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,8 +8,8 @@
|
|||||||
justify-items: stretch;
|
justify-items: stretch;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
margin-top: 2vh;
|
|
||||||
width: 75%;
|
width: 75%;
|
||||||
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.appItemBox {
|
.appItemBox {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
margin-right: .5em;
|
margin-right: .5em;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
font-size: 4em;
|
font-size: 3.5em;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
width: max-content;
|
width: max-content;
|
||||||
color: var(--color-text-acc);
|
color: var(--color-text-acc);
|
||||||
@@ -16,8 +16,7 @@
|
|||||||
&.root {
|
&.root {
|
||||||
display: flex;
|
display: flex;
|
||||||
font-family: -apple-system, Jost, BlinkMacSystemFont, Helvetica Neue, Roboto, sans-serif !important;
|
font-family: -apple-system, Jost, BlinkMacSystemFont, Helvetica Neue, Roboto, sans-serif !important;
|
||||||
font-size: 2em;
|
font-size: 28px;
|
||||||
height: 30px;
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin-right: 1em;
|
margin-right: 1em;
|
||||||
@@ -44,9 +43,9 @@
|
|||||||
.appName {
|
.appName {
|
||||||
&.root {
|
&.root {
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 0.8em;
|
font-size: 11px;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
color: light-dark(blue, black);
|
color: var(--color-text-pri);
|
||||||
font-family: 'Jost', sans-serif;
|
font-family: 'Jost', sans-serif;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
@@ -54,7 +53,7 @@
|
|||||||
|
|
||||||
.appUrl {
|
.appUrl {
|
||||||
&.root {
|
&.root {
|
||||||
font-size: 0.8em;
|
font-size: 11px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
@@ -65,7 +64,7 @@
|
|||||||
|
|
||||||
.linkCategory {
|
.linkCategory {
|
||||||
&.root {
|
&.root {
|
||||||
font-size: 1.1em;
|
font-size: 14px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
height: 10px;
|
height: 10px;
|
||||||
color: var(--color-text-acc);
|
color: var(--color-text-acc);
|
||||||
@@ -78,7 +77,7 @@
|
|||||||
.linkItem {
|
.linkItem {
|
||||||
&.root {
|
&.root {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 1em;
|
font-size: 14px;
|
||||||
line-height: 2;
|
line-height: 2;
|
||||||
color: var(--color-text-pri);
|
color: var(--color-text-pri);
|
||||||
&:hover {
|
&:hover {
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
.keyword{
|
.search{
|
||||||
|
&.root {
|
||||||
|
.wrapper {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
.input {
|
.input {
|
||||||
border: 0;
|
border: 0;
|
||||||
border-bottom: thin solid var(--color-border);
|
border-bottom: thin solid var(--color-border);
|
||||||
@@ -12,7 +16,16 @@
|
|||||||
padding-left: 1em;
|
padding-left: 1em;
|
||||||
padding-right: 1em;
|
padding-right: 1em;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
&:focus {
|
}
|
||||||
|
.section{
|
||||||
|
color: var(--color-border);
|
||||||
|
width: auto;
|
||||||
|
padding-left: .5rem;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.wrapper:focus-within {
|
||||||
|
.input {
|
||||||
background-color: var(--color-search-background);
|
background-color: var(--color-search-background);
|
||||||
border-color: var(--color-border);
|
border-color: var(--color-border);
|
||||||
outline: none;
|
outline: none;
|
||||||
@@ -27,43 +40,12 @@
|
|||||||
border-bottom-left-radius: .25em;
|
border-bottom-left-radius: .25em;
|
||||||
border-bottom-right-radius: .25em;
|
border-bottom-right-radius: .25em;
|
||||||
}
|
}
|
||||||
}
|
.section{
|
||||||
.label{
|
|
||||||
color: var(--color-border);
|
color: var(--color-border);
|
||||||
display: block;
|
width: auto;
|
||||||
position: relative;
|
padding-left: .5rem;
|
||||||
font-style: normal;
|
display: flex;
|
||||||
font-weight: 200;
|
}
|
||||||
font-size: 1.2em;
|
}
|
||||||
letter-spacing: .2em;
|
|
||||||
opacity: 1;
|
|
||||||
padding-left: 1em;
|
|
||||||
padding-right: 1em;
|
|
||||||
text-align: center;
|
|
||||||
width: 100%;
|
|
||||||
top: 28%;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.keyword:placeholder-shown + .label{
|
|
||||||
visibility: hidden;
|
|
||||||
z-index: 1;
|
|
||||||
position: absolute;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.keyword:focus:not(:placeholder-shown) + .label{
|
|
||||||
visibility: visible;
|
|
||||||
position: absolute;
|
|
||||||
z-index: 1;
|
|
||||||
opacity: 55%;
|
|
||||||
width: 100%;
|
|
||||||
top: 28%;
|
|
||||||
left: 0;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
.keyword:not(:placeholder-shown) + .label{
|
|
||||||
visibility: hidden;
|
|
||||||
z-index: 1;
|
|
||||||
position: absolute;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user