Linted
This commit is contained in:
@@ -2,17 +2,14 @@ module.exports = {
|
||||
root: true,
|
||||
env: { browser: true, es2020: true },
|
||||
extends: [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:react-hooks/recommended",
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:react-hooks/recommended',
|
||||
],
|
||||
ignorePatterns: ["dist", ".eslintrc.cjs"],
|
||||
parser: "@typescript-eslint/parser",
|
||||
plugins: ["react-refresh"],
|
||||
ignorePatterns: ['dist', '.eslintrc.cjs'],
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: ['react-refresh'],
|
||||
rules: {
|
||||
"react-refresh/only-export-components": [
|
||||
"warn",
|
||||
{ allowConstantExport: true },
|
||||
],
|
||||
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
|
||||
},
|
||||
};
|
||||
|
||||
52
biome.json
Normal file
52
biome.json
Normal file
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
|
||||
"organizeImports": {
|
||||
"enabled": true
|
||||
},
|
||||
"files": {
|
||||
"ignore": ["./node_modules/", "./dist/", "./.nx/"],
|
||||
"ignoreUnknown": true
|
||||
},
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"recommended": true,
|
||||
"a11y": {
|
||||
"noSvgWithoutTitle": "off",
|
||||
"all": true
|
||||
},
|
||||
"complexity": {
|
||||
"noUselessTypeConstraint": "off",
|
||||
"recommended": true
|
||||
},
|
||||
"suspicious": {
|
||||
"noExplicitAny": "off",
|
||||
"noConsoleLog": "error",
|
||||
"noImplicitAnyLet": "off",
|
||||
"recommended": true
|
||||
},
|
||||
"correctness": {
|
||||
"useExhaustiveDependencies": "off",
|
||||
"noUnusedImports": "error",
|
||||
"recommended": true
|
||||
},
|
||||
"performance": {
|
||||
"noDelete": "off",
|
||||
"recommended": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"formatter": {
|
||||
"enabled": true,
|
||||
"formatWithErrors": false,
|
||||
"indentStyle": "tab",
|
||||
"indentWidth": 2,
|
||||
"lineWidth": 90
|
||||
},
|
||||
"javascript": {
|
||||
"formatter": {
|
||||
"quoteStyle": "single",
|
||||
"jsxQuoteStyle": "single"
|
||||
}
|
||||
}
|
||||
}
|
||||
63
src/App.tsx
63
src/App.tsx
@@ -1,36 +1,36 @@
|
||||
import Homepage from "./pages/homepage/Homepage";
|
||||
import {
|
||||
MantineProvider,
|
||||
DEFAULT_THEME,
|
||||
MantineProvider,
|
||||
createTheme,
|
||||
mergeMantineTheme,
|
||||
} from "@mantine/core";
|
||||
} from '@mantine/core';
|
||||
import { useLocalStorage } from '@mantine/hooks';
|
||||
import { ModalsProvider } from '@mantine/modals';
|
||||
import { useEffect } from 'react';
|
||||
import {
|
||||
Route,
|
||||
RouterProvider,
|
||||
createBrowserRouter,
|
||||
createRoutesFromElements,
|
||||
RouterProvider,
|
||||
} from "react-router-dom";
|
||||
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
|
||||
import { appTheme } from "./contexts/theme";
|
||||
import { useAtom } from "jotai";
|
||||
} from 'react-router-dom';
|
||||
import ThemeProvider from './components/ThemeProvider';
|
||||
import { useQueryAPI } from './hooks/useAPI';
|
||||
import Homepage from './pages/homepage/Homepage';
|
||||
import Settings from './pages/settings/Settings';
|
||||
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
|
||||
import { useAtom } from 'jotai';
|
||||
import { appTheme } from './contexts/theme';
|
||||
|
||||
function App() {
|
||||
const { data, isFetched } = useQueryAPI({
|
||||
endpoint: "api/themes",
|
||||
endpoint: 'api/themes',
|
||||
});
|
||||
|
||||
const [themeName, setThemeName] = useLocalStorage<any>({
|
||||
key: "theme",
|
||||
defaultValue: "blackboard",
|
||||
key: 'theme',
|
||||
defaultValue: 'blackboard',
|
||||
});
|
||||
|
||||
const [theme, setTheme] = useAtom(appTheme);
|
||||
@@ -45,37 +45,30 @@ function App() {
|
||||
const router = createBrowserRouter(
|
||||
createRoutesFromElements(
|
||||
<Route>
|
||||
<Route path="/trigger" element={<Homepage theme={theme} />} />
|
||||
<Route
|
||||
path="/trigger/settings"
|
||||
element={<Settings theme={theme} />}
|
||||
/>
|
||||
<Route path='/trigger' element={<Homepage theme={theme} />} />
|
||||
<Route path='/trigger/settings' element={<Settings theme={theme} />} />
|
||||
</Route>,
|
||||
),
|
||||
);
|
||||
|
||||
const overrides = createTheme({
|
||||
white: theme?.colorbackground,
|
||||
fontFamily:
|
||||
"-apple-system,Jost,BlinkMacSystemFont,Helvetica Neue,Roboto,sans-serif",
|
||||
fontFamily: '-apple-system,Jost,BlinkMacSystemFont,Helvetica Neue,Roboto,sans-serif',
|
||||
});
|
||||
|
||||
const mantineTheme = mergeMantineTheme(DEFAULT_THEME, overrides);
|
||||
|
||||
return (
|
||||
<>
|
||||
{theme && (
|
||||
{theme && (
|
||||
<MantineProvider theme={mantineTheme}>
|
||||
<ThemeProvider theme={theme}>
|
||||
<ModalsProvider >
|
||||
<RouterProvider router={router} />
|
||||
</ModalsProvider>
|
||||
</ThemeProvider>
|
||||
<ThemeProvider theme={theme}>
|
||||
<ModalsProvider>
|
||||
<RouterProvider router={router} />
|
||||
</ModalsProvider>
|
||||
</ThemeProvider>
|
||||
</MantineProvider>
|
||||
)}
|
||||
</>
|
||||
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import {
|
||||
type MRT_Row,
|
||||
type MRT_TableOptions,
|
||||
MantineReactTable,
|
||||
MRT_Row,
|
||||
MRT_TableOptions,
|
||||
useMantineReactTable,
|
||||
} from "mantine-react-table";
|
||||
import { memo } from "react";
|
||||
import "../dataTableStyles.css";
|
||||
import { ActionIcon, Button, Flex, Text } from "@mantine/core";
|
||||
import { FiPlus } from "react-icons/fi";
|
||||
import { IconEdit, IconTrash } from "@tabler/icons-react";
|
||||
import { useMutationAPI } from "../hooks/useAPI";
|
||||
import { modals } from "@mantine/modals";
|
||||
import { actionIconClasses, buttonClasses } from "../styles";
|
||||
import { appTheme } from "../contexts/theme";
|
||||
import { useAtom } from "jotai";
|
||||
} from 'mantine-react-table';
|
||||
import { memo } from 'react';
|
||||
import '../dataTableStyles.css';
|
||||
import { ActionIcon, Button, Flex, Text } from '@mantine/core';
|
||||
import { modals } from '@mantine/modals';
|
||||
import { IconEdit, IconTrash } from '@tabler/icons-react';
|
||||
import { useAtom } from 'jotai';
|
||||
import { FiPlus } from 'react-icons/fi';
|
||||
import { appTheme } from '../contexts/theme';
|
||||
import { useMutationAPI } from '../hooks/useAPI';
|
||||
import { actionIconClasses, buttonClasses } from '../styles';
|
||||
|
||||
export function DataTableComponent({
|
||||
tableName,
|
||||
@@ -34,29 +34,28 @@ export function DataTableComponent({
|
||||
const { mutateAsync: createRow } = useMutationAPI();
|
||||
const { mutateAsync: editRow } = useMutationAPI();
|
||||
const { mutateAsync: deleteRow } = useMutationAPI();
|
||||
const handleCreateRow: MRT_TableOptions<any>["onCreatingRowSave"] = async ({
|
||||
const handleCreateRow: MRT_TableOptions<any>['onCreatingRowSave'] = async ({
|
||||
values,
|
||||
exitCreatingMode,
|
||||
}) => {
|
||||
createRow({ method: "POST", endpoint: endpoint, body: values });
|
||||
createRow({ method: 'POST', endpoint: endpoint, body: values });
|
||||
exitCreatingMode();
|
||||
};
|
||||
const handleEditRow: MRT_TableOptions<any>["onEditingRowSave"] = async ({
|
||||
const handleEditRow: MRT_TableOptions<any>['onEditingRowSave'] = async ({
|
||||
values,
|
||||
table,
|
||||
}) => {
|
||||
editRow({ method: "PATCH", endpoint: endpoint, body: values });
|
||||
editRow({ method: 'PATCH', endpoint: endpoint, body: values });
|
||||
table.setEditingRow(null);
|
||||
};
|
||||
console.log(theme)
|
||||
const openDeleteConfirmModal = (row: MRT_Row<any>) =>
|
||||
modals.openConfirmModal({
|
||||
title: "Are you sure you want to delete this user?",
|
||||
title: 'Are you sure you want to delete this user?',
|
||||
children: <Text>Are you sure?</Text>,
|
||||
labels: { confirm: "Delete", cancel: "Cancel" },
|
||||
confirmProps: { color: "red" },
|
||||
labels: { confirm: 'Delete', cancel: 'Cancel' },
|
||||
confirmProps: { color: 'red' },
|
||||
onConfirm: () =>
|
||||
deleteRow({ method: "DELETE", endpoint: endpoint, body: row.original }),
|
||||
deleteRow({ method: 'DELETE', endpoint: endpoint, body: row.original }),
|
||||
});
|
||||
const table = useMantineReactTable({
|
||||
columns: columns,
|
||||
@@ -65,8 +64,8 @@ console.log(theme)
|
||||
enablePagination: false,
|
||||
enableRowVirtualization: true,
|
||||
enableEditing: true,
|
||||
createDisplayMode: "modal",
|
||||
editDisplayMode: "row",
|
||||
createDisplayMode: 'modal',
|
||||
editDisplayMode: 'row',
|
||||
enableBottomToolbar: false,
|
||||
enableToolbarInternalActions: false,
|
||||
onCreatingRowSave: handleCreateRow,
|
||||
@@ -82,13 +81,17 @@ console.log(theme)
|
||||
showLoadingOverlay: isLoading,
|
||||
isLoading: isLoading,
|
||||
},
|
||||
mantinePaperProps: {className: 'root'},
|
||||
mantinePaperProps: { className: 'root' },
|
||||
renderRowActions: ({ row, table }) => (
|
||||
<Flex gap="md">
|
||||
<ActionIcon className={actionIconClasses.editButton} classNames={actionIconClasses} onClick={() => table.setEditingRow(row)}>
|
||||
<Flex gap='md'>
|
||||
<ActionIcon
|
||||
className={actionIconClasses.editButton}
|
||||
classNames={actionIconClasses}
|
||||
onClick={() => table.setEditingRow(row)}
|
||||
>
|
||||
<IconEdit />
|
||||
</ActionIcon>
|
||||
<ActionIcon color="red" onClick={() => openDeleteConfirmModal(row)}>
|
||||
<ActionIcon color='red' onClick={() => openDeleteConfirmModal(row)}>
|
||||
<IconTrash />
|
||||
</ActionIcon>
|
||||
</Flex>
|
||||
@@ -100,7 +103,12 @@ console.log(theme)
|
||||
},
|
||||
renderTopToolbarCustomActions: ({ table }) => {
|
||||
return (
|
||||
<Button className={buttonClasses.tableButton} classNames={buttonClasses} disabled={tableName === "Personalization"} onClick={() => table.setCreatingRow(true)}>
|
||||
<Button
|
||||
className={buttonClasses.tableButton}
|
||||
classNames={buttonClasses}
|
||||
disabled={tableName === 'Personalization'}
|
||||
onClick={() => table.setCreatingRow(true)}
|
||||
>
|
||||
<FiPlus />
|
||||
</Button>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { MRT_ColumnDef } from "mantine-react-table";
|
||||
import { useMemo } from "react";
|
||||
import type { MRT_ColumnDef } from 'mantine-react-table';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
export default function ApplicationColumns() {
|
||||
const columns = useMemo<MRT_ColumnDef<any>[]>(
|
||||
@@ -9,14 +9,14 @@ export default function ApplicationColumns() {
|
||||
if (row.id) {
|
||||
return `${row.id}`;
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
enableEditing: false,
|
||||
id: "id",
|
||||
header: "ID",
|
||||
id: 'id',
|
||||
header: 'ID',
|
||||
size: 50,
|
||||
mantineCopyButtonProps: ({ cell, row }) => ({
|
||||
className: "id",
|
||||
className: 'id',
|
||||
id: `${cell.getValue()}-id`,
|
||||
}),
|
||||
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||
@@ -27,12 +27,12 @@ export default function ApplicationColumns() {
|
||||
if (row.name) {
|
||||
return `${row.name}`;
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
id: "name",
|
||||
header: "Name",
|
||||
id: 'name',
|
||||
header: 'Name',
|
||||
mantineCopyButtonProps: ({ cell, row }) => ({
|
||||
className: "name",
|
||||
className: 'name',
|
||||
id: `${cell.getValue()}-name`,
|
||||
}),
|
||||
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||
@@ -43,12 +43,12 @@ export default function ApplicationColumns() {
|
||||
if (row.url) {
|
||||
return `${row.url}`;
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
id: "url",
|
||||
header: "Url",
|
||||
id: 'url',
|
||||
header: 'Url',
|
||||
mantineCopyButtonProps: ({ cell, row }) => ({
|
||||
className: "url",
|
||||
className: 'url',
|
||||
id: `${cell.getValue()}-url`,
|
||||
}),
|
||||
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||
@@ -59,12 +59,12 @@ export default function ApplicationColumns() {
|
||||
if (row.icon) {
|
||||
return `${row.icon}`;
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
id: "icon",
|
||||
header: "Icon",
|
||||
id: 'icon',
|
||||
header: 'Icon',
|
||||
mantineCopyButtonProps: ({ cell, row }) => ({
|
||||
className: "icon",
|
||||
className: 'icon',
|
||||
id: `${cell.getValue()}-icon`,
|
||||
}),
|
||||
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||
@@ -75,12 +75,12 @@ export default function ApplicationColumns() {
|
||||
if (row.urlbase) {
|
||||
return `${row.urlbase}`;
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
id: "urlbase",
|
||||
header: "Base Url",
|
||||
id: 'urlbase',
|
||||
header: 'Base Url',
|
||||
mantineCopyButtonProps: ({ cell, row }) => ({
|
||||
className: "urlbase",
|
||||
className: 'urlbase',
|
||||
id: `${cell.getValue()}-urlbase`,
|
||||
}),
|
||||
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||
@@ -91,12 +91,12 @@ export default function ApplicationColumns() {
|
||||
if (row.category) {
|
||||
return `${row.category}`;
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
id: "category",
|
||||
header: "Category",
|
||||
id: 'category',
|
||||
header: 'Category',
|
||||
mantineCopyButtonProps: ({ cell, row }) => ({
|
||||
className: "category",
|
||||
className: 'category',
|
||||
id: `${cell.getValue()}-category`,
|
||||
}),
|
||||
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { MRT_ColumnDef } from "mantine-react-table";
|
||||
import { useMemo } from "react";
|
||||
import type { MRT_ColumnDef } from 'mantine-react-table';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
export default function ApplicationColumns(groups: any, groupData: any) {
|
||||
const columns = useMemo<MRT_ColumnDef<any>[]>(
|
||||
@@ -9,14 +9,14 @@ export default function ApplicationColumns(groups: any, groupData: any) {
|
||||
if (row.id) {
|
||||
return `${row.id}`;
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
enableEditing: false,
|
||||
id: "id",
|
||||
header: "ID",
|
||||
id: 'id',
|
||||
header: 'ID',
|
||||
size: 50,
|
||||
mantineCopyButtonProps: ({ cell, row }) => ({
|
||||
className: "id",
|
||||
className: 'id',
|
||||
id: `${cell.getValue()}-id`,
|
||||
}),
|
||||
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||
@@ -27,12 +27,12 @@ export default function ApplicationColumns(groups: any, groupData: any) {
|
||||
if (row.name) {
|
||||
return `${row.name}`;
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
id: "name",
|
||||
header: "Name",
|
||||
id: 'name',
|
||||
header: 'Name',
|
||||
mantineCopyButtonProps: ({ cell, row }) => ({
|
||||
className: "name",
|
||||
className: 'name',
|
||||
id: `${cell.getValue()}-name`,
|
||||
}),
|
||||
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||
@@ -43,12 +43,12 @@ export default function ApplicationColumns(groups: any, groupData: any) {
|
||||
if (row.url) {
|
||||
return `${row.url}`;
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
id: "url",
|
||||
header: "Url",
|
||||
id: 'url',
|
||||
header: 'Url',
|
||||
mantineCopyButtonProps: ({ cell, row }) => ({
|
||||
className: "url",
|
||||
className: 'url',
|
||||
id: `${cell.getValue()}-url`,
|
||||
}),
|
||||
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||
@@ -60,14 +60,14 @@ export default function ApplicationColumns(groups: any, groupData: any) {
|
||||
if (index !== null && index !== undefined) {
|
||||
return `${index}`;
|
||||
}
|
||||
return "N/A";
|
||||
return 'N/A';
|
||||
},
|
||||
id: "category",
|
||||
header: "Category",
|
||||
editVariant: "select",
|
||||
id: 'category',
|
||||
header: 'Category',
|
||||
editVariant: 'select',
|
||||
mantineEditSelectProps: { data: groups },
|
||||
mantineCopyButtonProps: ({ cell, row }) => ({
|
||||
className: "category",
|
||||
className: 'category',
|
||||
id: `${cell.getValue()}-category`,
|
||||
}),
|
||||
Cell: ({ renderedCellValue, row }) =>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { MRT_ColumnDef } from "mantine-react-table";
|
||||
import { useMemo } from "react";
|
||||
import type { MRT_ColumnDef } from 'mantine-react-table';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
export default function CategoryColumns() {
|
||||
const columns = useMemo<MRT_ColumnDef<any>[]>(
|
||||
@@ -9,11 +9,11 @@ export default function CategoryColumns() {
|
||||
if (row.id) {
|
||||
return `${row.id}`;
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
enableEditing: false,
|
||||
id: "id",
|
||||
header: "ID",
|
||||
id: 'id',
|
||||
header: 'ID',
|
||||
size: 50,
|
||||
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||
Header: ({ column }) => column.columnDef.header,
|
||||
@@ -23,10 +23,10 @@ export default function CategoryColumns() {
|
||||
if (row.category_name) {
|
||||
return `${row.category_name}`;
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
id: "category_name",
|
||||
header: "Name",
|
||||
id: 'category_name',
|
||||
header: 'Name',
|
||||
size: 50,
|
||||
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||
Header: ({ column }) => column.columnDef.header,
|
||||
@@ -36,11 +36,11 @@ export default function CategoryColumns() {
|
||||
if (row.category_index > -1) {
|
||||
return `${row.category_index}`;
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
enableEditing: false,
|
||||
id: "category_index",
|
||||
header: "Index",
|
||||
id: 'category_index',
|
||||
header: 'Index',
|
||||
size: 50,
|
||||
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||
Header: ({ column }) => column.columnDef.header,
|
||||
@@ -50,10 +50,10 @@ export default function CategoryColumns() {
|
||||
if (row.column_filter) {
|
||||
return `${row.column_filter}`;
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
id: "column_filter",
|
||||
header: "Filter Name",
|
||||
id: 'column_filter',
|
||||
header: 'Filter Name',
|
||||
size: 50,
|
||||
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||
Header: ({ column }) => column.columnDef.header,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { MRT_ColumnDef } from "mantine-react-table";
|
||||
import { useMemo } from "react";
|
||||
import type { MRT_ColumnDef } from 'mantine-react-table';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
export default function MessagesColumns() {
|
||||
const columns = useMemo<MRT_ColumnDef<any>[]>(
|
||||
@@ -9,14 +9,14 @@ export default function MessagesColumns() {
|
||||
if (row.id) {
|
||||
return `${row.id}`;
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
enableEditing: false,
|
||||
id: "id",
|
||||
header: "ID",
|
||||
id: 'id',
|
||||
header: 'ID',
|
||||
size: 50,
|
||||
mantineCopyButtonProps: ({ cell, row }) => ({
|
||||
className: "id",
|
||||
className: 'id',
|
||||
id: `${cell.getValue()}-id`,
|
||||
}),
|
||||
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||
@@ -27,12 +27,12 @@ export default function MessagesColumns() {
|
||||
if (row.message) {
|
||||
return `${row.message}`;
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
id: "message",
|
||||
header: "Message",
|
||||
id: 'message',
|
||||
header: 'Message',
|
||||
mantineCopyButtonProps: ({ cell, row }) => ({
|
||||
className: "message",
|
||||
className: 'message',
|
||||
id: `${cell.getValue()}-message`,
|
||||
}),
|
||||
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||
@@ -43,12 +43,12 @@ export default function MessagesColumns() {
|
||||
if (row.easteregg) {
|
||||
return `${row.easteregg}`;
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
id: "easteregg",
|
||||
header: "Easter Egg?",
|
||||
id: 'easteregg',
|
||||
header: 'Easter Egg?',
|
||||
mantineCopyButtonProps: ({ cell, row }) => ({
|
||||
className: "easteregg",
|
||||
className: 'easteregg',
|
||||
id: `${cell.getValue()}-easteregg`,
|
||||
}),
|
||||
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { MRT_ColumnDef } from "mantine-react-table";
|
||||
import { useMemo } from "react";
|
||||
import type { MRT_ColumnDef } from 'mantine-react-table';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
export default function PersonalizationColumns() {
|
||||
const columns = useMemo<MRT_ColumnDef<any>[]>(
|
||||
@@ -9,13 +9,13 @@ export default function PersonalizationColumns() {
|
||||
if (row.firstname) {
|
||||
return `${row.firstname}`;
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
id: "firstname",
|
||||
header: "First Name",
|
||||
id: 'firstname',
|
||||
header: 'First Name',
|
||||
size: 50,
|
||||
mantineCopyButtonProps: ({ cell, row }) => ({
|
||||
className: "firstname",
|
||||
className: 'firstname',
|
||||
id: `${cell.getValue()}-firstname`,
|
||||
}),
|
||||
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||
@@ -26,12 +26,12 @@ export default function PersonalizationColumns() {
|
||||
if (row.lastname) {
|
||||
return `${row.lastname}`;
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
id: "lastname",
|
||||
header: "Last Name",
|
||||
id: 'lastname',
|
||||
header: 'Last Name',
|
||||
mantineCopyButtonProps: ({ cell, row }) => ({
|
||||
className: "lastname",
|
||||
className: 'lastname',
|
||||
id: `${cell.getValue()}-lastname`,
|
||||
}),
|
||||
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||
@@ -42,12 +42,12 @@ export default function PersonalizationColumns() {
|
||||
if (row.email) {
|
||||
return `${row.email}`;
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
id: "email",
|
||||
header: "Email",
|
||||
id: 'email',
|
||||
header: 'Email',
|
||||
mantineCopyButtonProps: ({ cell, row }) => ({
|
||||
className: "email",
|
||||
className: 'email',
|
||||
id: `${cell.getValue()}-email`,
|
||||
}),
|
||||
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { MRT_ColumnDef } from "mantine-react-table";
|
||||
import { useMemo } from "react";
|
||||
import type { MRT_ColumnDef } from 'mantine-react-table';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
export default function SearchProviderColumns() {
|
||||
const columns = useMemo<MRT_ColumnDef<any>[]>(
|
||||
@@ -9,11 +9,11 @@ export default function SearchProviderColumns() {
|
||||
if (row.id) {
|
||||
return `${row.id}`;
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
enableEditing: false,
|
||||
id: "id",
|
||||
header: "ID",
|
||||
id: 'id',
|
||||
header: 'ID',
|
||||
size: 50,
|
||||
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||
Header: ({ column }) => column.columnDef.header,
|
||||
@@ -23,10 +23,10 @@ export default function SearchProviderColumns() {
|
||||
if (row.name) {
|
||||
return `${row.name}`;
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
id: "name",
|
||||
header: "Name",
|
||||
id: 'name',
|
||||
header: 'Name',
|
||||
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||
Header: ({ column }) => column.columnDef.header,
|
||||
},
|
||||
@@ -35,10 +35,10 @@ export default function SearchProviderColumns() {
|
||||
if (row.url) {
|
||||
return `${row.url}`;
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
id: "url",
|
||||
header: "Url",
|
||||
id: 'url',
|
||||
header: 'Url',
|
||||
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||
Header: ({ column }) => column.columnDef.header,
|
||||
},
|
||||
@@ -47,10 +47,10 @@ export default function SearchProviderColumns() {
|
||||
if (row.prefix) {
|
||||
return `${row.prefix}`;
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
id: "prefix",
|
||||
header: "Prefix",
|
||||
id: 'prefix',
|
||||
header: 'Prefix',
|
||||
Cell: ({ renderedCellValue, row }) => renderedCellValue,
|
||||
Header: ({ column }) => column.columnDef.header,
|
||||
},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Box } from "@mantine/core";
|
||||
import { Box } from '@mantine/core';
|
||||
|
||||
export default function ThemeProvider({
|
||||
theme,
|
||||
@@ -7,11 +7,12 @@ export default function ThemeProvider({
|
||||
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,
|
||||
'--color-text-pri': theme.colortextpri,
|
||||
'--color-text-acc': theme.colortextacc,
|
||||
'--color-background': theme.colorbackground,
|
||||
'--color-border': theme.colorborder,
|
||||
'--color-search-background': theme.colorsearchbackground,
|
||||
'--image-background': `url(${theme.imagebackground})`,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Stack, Text } from "@mantine/core";
|
||||
import { stackClasses } from "../styles";
|
||||
import { Stack, Text } from '@mantine/core';
|
||||
import { stackClasses } from '../styles';
|
||||
|
||||
export function ToastError({ err }: { err: any }) {
|
||||
const errorResponse = JSON.parse(err.message);
|
||||
return (
|
||||
<Stack className={stackClasses.VStack} style={{ alignItems: "flex-start" }}>
|
||||
<Stack className={stackClasses.VStack} style={{ alignItems: 'flex-start' }}>
|
||||
<Text>
|
||||
Status: {errorResponse.status} {errorResponse.statusText}
|
||||
</Text>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import { atom } from "jotai";
|
||||
import { atom } from 'jotai';
|
||||
|
||||
export const HomepageFilters = atom([{ value: "All", label: "All" }]);
|
||||
export const HomepageFilters = atom([{ value: 'All', label: 'All' }]);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { atom } from "jotai";
|
||||
import { atom } from 'jotai';
|
||||
|
||||
const appTheme = atom<any>({});
|
||||
|
||||
export { appTheme }
|
||||
export { appTheme };
|
||||
|
||||
@@ -1 +1 @@
|
||||
export { useQueryAPI } from "./useAPI";
|
||||
export { useQueryAPI } from './useAPI';
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
import {
|
||||
useInfiniteQuery,
|
||||
useMutation,
|
||||
useQuery,
|
||||
useQueryClient,
|
||||
useMutation,
|
||||
useInfiniteQuery,
|
||||
} from "@tanstack/react-query";
|
||||
import { useCallback } from "react";
|
||||
import { toast } from "react-toastify";
|
||||
} from '@tanstack/react-query';
|
||||
import { useCallback } from 'react';
|
||||
import { toast } from 'react-toastify';
|
||||
|
||||
export function useQueryAPI({ endpoint }: { endpoint: string }) {
|
||||
const callEndpoint = async (endpoint: string) => {
|
||||
const url = `http://localhost:5000/trigger/${endpoint}`;
|
||||
const options: object = {
|
||||
method: "GET",
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Access-Control-Allow-Headers": "*",
|
||||
"Access-Control-Allow-Methods": "POST, GET, OPTIONS",
|
||||
"Access-Control-Allow-Credentials": true,
|
||||
"Sec-Fetch-Mode": "no-cors",
|
||||
"Sec-Fetch-Site": "same-site",
|
||||
'Content-Type': 'application/json',
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Headers': '*',
|
||||
'Access-Control-Allow-Methods': 'POST, GET, OPTIONS',
|
||||
'Access-Control-Allow-Credentials': true,
|
||||
'Sec-Fetch-Mode': 'no-cors',
|
||||
'Sec-Fetch-Site': 'same-site',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -31,7 +31,7 @@ export function useQueryAPI({ endpoint }: { endpoint: string }) {
|
||||
};
|
||||
|
||||
return useQuery({
|
||||
queryKey: ["GET", endpoint],
|
||||
queryKey: ['GET', endpoint],
|
||||
queryFn: () => callEndpoint(endpoint),
|
||||
});
|
||||
}
|
||||
@@ -46,13 +46,13 @@ export function useMutationAPI() {
|
||||
const options: any = {
|
||||
method: method,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Access-Control-Allow-Headers": "*",
|
||||
"Access-Control-Allow-Methods": "POST, GET, OPTIONS",
|
||||
"Access-Control-Allow-Credentials": true,
|
||||
"Sec-Fetch-Mode": "no-cors",
|
||||
"Sec-Fetch-Site": "same-site",
|
||||
'Content-Type': 'application/json',
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Headers': '*',
|
||||
'Access-Control-Allow-Methods': 'POST, GET, OPTIONS',
|
||||
'Access-Control-Allow-Credentials': true,
|
||||
'Sec-Fetch-Mode': 'no-cors',
|
||||
'Sec-Fetch-Site': 'same-site',
|
||||
},
|
||||
body: JSON.stringify(body),
|
||||
};
|
||||
@@ -60,7 +60,7 @@ export function useMutationAPI() {
|
||||
const response = await fetch(url, options);
|
||||
if (!response.ok) {
|
||||
const responseData = await response.json();
|
||||
if (typeof responseData.detail !== "string") {
|
||||
if (typeof responseData.detail !== 'string') {
|
||||
const errorResponse = JSON.stringify({
|
||||
status: response.status,
|
||||
statusText: response.statusText,
|
||||
@@ -73,7 +73,7 @@ export function useMutationAPI() {
|
||||
|
||||
throw new Error(errorResponse);
|
||||
}
|
||||
if (typeof responseData.detail === "object") {
|
||||
if (typeof responseData.detail === 'object') {
|
||||
const errorResponse = JSON.stringify({
|
||||
status: response.status,
|
||||
statusText: response.statusText,
|
||||
@@ -110,17 +110,17 @@ export function useMutationAPI() {
|
||||
}) => callEndpoint(method, endpoint, body),
|
||||
onMutate: () => {},
|
||||
onSuccess: (data, variables) => {
|
||||
queryClient.invalidateQueries({ queryKey: ["GET", variables.endpoint] });
|
||||
queryClient.invalidateQueries({ queryKey: ['GET', variables.endpoint] });
|
||||
|
||||
if (variables.endpoint.includes("/")) {
|
||||
if (variables.endpoint.includes('/')) {
|
||||
if ((variables.endpoint.match(/\//g) || []).length > 2) {
|
||||
const GetEndpoint = variables.endpoint.split("/");
|
||||
const GetEndpoint = variables.endpoint.split('/');
|
||||
const Endpoint = `${GetEndpoint[1]}/${GetEndpoint[2]}`;
|
||||
queryClient.invalidateQueries({ queryKey: ["GET", `/${Endpoint}`] });
|
||||
queryClient.invalidateQueries({ queryKey: ['GET', `/${Endpoint}`] });
|
||||
} else {
|
||||
const GetEndpoint = variables.endpoint.split("/")[1];
|
||||
const GetEndpoint = variables.endpoint.split('/')[1];
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ["GET", `/${GetEndpoint}`],
|
||||
queryKey: ['GET', `/${GetEndpoint}`],
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -139,20 +139,20 @@ export function useFileUploadAPI() {
|
||||
const options = {
|
||||
method: method,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Access-Control-Allow-Headers": "*",
|
||||
"Access-Control-Allow-Methods": "POST, GET, OPTIONS",
|
||||
"Access-Control-Allow-Credentials": true,
|
||||
"Sec-Fetch-Mode": "no-cors",
|
||||
"Sec-Fetch-Site": "same-site",
|
||||
'Content-Type': 'application/json',
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Headers': '*',
|
||||
'Access-Control-Allow-Methods': 'POST, GET, OPTIONS',
|
||||
'Access-Control-Allow-Credentials': true,
|
||||
'Sec-Fetch-Mode': 'no-cors',
|
||||
'Sec-Fetch-Site': 'same-site',
|
||||
},
|
||||
body: body ?? undefined,
|
||||
};
|
||||
const response = await fetch(url, options as unknown as Body);
|
||||
if (!response.ok) {
|
||||
const responseData = await response.json();
|
||||
if (typeof responseData.detail !== "string") {
|
||||
if (typeof responseData.detail !== 'string') {
|
||||
const errorResponse = JSON.stringify({
|
||||
status: response.status,
|
||||
statusText: response.statusText,
|
||||
@@ -192,10 +192,10 @@ export function useFileUploadAPI() {
|
||||
}) => callEndpoint(method, endpoint, body),
|
||||
onMutate: () => {},
|
||||
onSuccess: (variables) => {
|
||||
queryClient.invalidateQueries({ queryKey: ["GET", variables.endpoint] });
|
||||
if (variables.endpoint?.includes("/")) {
|
||||
const GetEndpoint = variables.endpoint.split("/")[1];
|
||||
queryClient.invalidateQueries({ queryKey: ["GET", `/${GetEndpoint}`] });
|
||||
queryClient.invalidateQueries({ queryKey: ['GET', variables.endpoint] });
|
||||
if (variables.endpoint?.includes('/')) {
|
||||
const GetEndpoint = variables.endpoint.split('/')[1];
|
||||
queryClient.invalidateQueries({ queryKey: ['GET', `/${GetEndpoint}`] });
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -210,7 +210,7 @@ export function useFetchAllRecordsAPI({ endpoint }: { endpoint: string }) {
|
||||
const url = new URL(`http://localhost:5000/trigger/${endpoint}`);
|
||||
|
||||
// Check and append custom query parameters from the endpoint
|
||||
const customParams = new URLSearchParams(endpoint.split("?")[1]);
|
||||
const customParams = new URLSearchParams(endpoint.split('?')[1]);
|
||||
for (const [key, value] of customParams) {
|
||||
if (!url.searchParams.has(key)) {
|
||||
url.searchParams.append(key, value);
|
||||
@@ -218,19 +218,19 @@ export function useFetchAllRecordsAPI({ endpoint }: { endpoint: string }) {
|
||||
}
|
||||
|
||||
// Add 'page' and 'size' parameters
|
||||
url.searchParams.set("page", page.toString()); // Use 'set' to ensure uniqueness
|
||||
url.searchParams.set("size", pageSize.toString());
|
||||
url.searchParams.set('page', page.toString()); // Use 'set' to ensure uniqueness
|
||||
url.searchParams.set('size', pageSize.toString());
|
||||
|
||||
const options: any = {
|
||||
method: "GET",
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Access-Control-Allow-Headers": "*",
|
||||
"Access-Control-Allow-Methods": "POST, GET, OPTIONS",
|
||||
"Access-Control-Allow-Credentials": true,
|
||||
"Sec-Fetch-Mode": "no-cors",
|
||||
"Sec-Fetch-Site": "same-site",
|
||||
'Content-Type': 'application/json',
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Headers': '*',
|
||||
'Access-Control-Allow-Methods': 'POST, GET, OPTIONS',
|
||||
'Access-Control-Allow-Credentials': true,
|
||||
'Sec-Fetch-Mode': 'no-cors',
|
||||
'Sec-Fetch-Site': 'same-site',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -295,18 +295,18 @@ export function useFetchAllRecordsAPI({ endpoint }: { endpoint: string }) {
|
||||
return allItems;
|
||||
} catch (error) {
|
||||
// Handling errors in fetching the first page
|
||||
console.error("Error fetching the first page:", error);
|
||||
console.error('Error fetching the first page:', error);
|
||||
return []; // Return empty array on error
|
||||
}
|
||||
};
|
||||
|
||||
const invalidate = useCallback(() => {
|
||||
queryClient.invalidateQueries({ queryKey: ["GET", endpoint] });
|
||||
queryClient.invalidateQueries({ queryKey: ['GET', endpoint] });
|
||||
}, [queryClient, endpoint]);
|
||||
|
||||
return {
|
||||
...useQuery({
|
||||
queryKey: ["GET", endpoint],
|
||||
queryKey: ['GET', endpoint],
|
||||
queryFn: callEndpoint,
|
||||
}),
|
||||
invalidate,
|
||||
@@ -323,31 +323,31 @@ export function useDownloadFile() {
|
||||
async ({ endpoint, file_name }: DownloadFileOptions) => {
|
||||
const url = `http://localhost:5000/trigger/${endpoint}`;
|
||||
const options: any = {
|
||||
method: "GET",
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Access-Control-Allow-Headers": "*",
|
||||
"Access-Control-Allow-Methods": "POST, GET, OPTIONS",
|
||||
"Access-Control-Allow-Credentials": true,
|
||||
"Sec-Fetch-Mode": "no-cors",
|
||||
"Sec-Fetch-Site": "same-site",
|
||||
'Content-Type': 'application/json',
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Headers': '*',
|
||||
'Access-Control-Allow-Methods': 'POST, GET, OPTIONS',
|
||||
'Access-Control-Allow-Credentials': true,
|
||||
'Sec-Fetch-Mode': 'no-cors',
|
||||
'Sec-Fetch-Site': 'same-site',
|
||||
},
|
||||
};
|
||||
const toastID = toast.loading("Processing...");
|
||||
const toastID = toast.loading('Processing...');
|
||||
try {
|
||||
const response = await fetch(url, options);
|
||||
if (!response.ok) {
|
||||
throw new Error("Network response was not ok");
|
||||
throw new Error('Network response was not ok');
|
||||
}
|
||||
|
||||
const blob = await response.blob();
|
||||
if (blob.type === "application/json") {
|
||||
if (blob.type === 'application/json') {
|
||||
const blob_text = await blob.text();
|
||||
const cleaned_text = blob_text.replace(/"/g, "");
|
||||
const cleaned_text = blob_text.replace(/"/g, '');
|
||||
toast.update(toastID, {
|
||||
render: cleaned_text,
|
||||
type: "info",
|
||||
type: 'info',
|
||||
isLoading: false,
|
||||
autoClose: 5000,
|
||||
closeButton: null,
|
||||
@@ -355,11 +355,11 @@ export function useDownloadFile() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
if (typeof window !== 'undefined') {
|
||||
const blobURL = window.URL.createObjectURL(blob);
|
||||
const a = document.createElement("a");
|
||||
const a = document.createElement('a');
|
||||
|
||||
a.style.display = "none";
|
||||
a.style.display = 'none';
|
||||
a.href = blobURL;
|
||||
a.download = file_name;
|
||||
|
||||
@@ -369,17 +369,17 @@ export function useDownloadFile() {
|
||||
document.body.removeChild(a);
|
||||
toast.update(toastID, {
|
||||
render: `${file_name} Downloaded`,
|
||||
type: "success",
|
||||
type: 'success',
|
||||
isLoading: false,
|
||||
autoClose: 5000,
|
||||
closeButton: null,
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Download failed:", error);
|
||||
console.error('Download failed:', error);
|
||||
toast.update(toastID, {
|
||||
render: `Error Downloading ${file_name}. Please try again.`,
|
||||
type: "error",
|
||||
type: 'error',
|
||||
isLoading: false,
|
||||
autoClose: 5000,
|
||||
closeButton: null,
|
||||
@@ -399,27 +399,27 @@ export const useFetchInfiniteQuery = ({
|
||||
endpoint: string;
|
||||
pageSize?: number;
|
||||
}) => {
|
||||
const queryKey = ["GET", endpoint];
|
||||
const queryKey = ['GET', endpoint];
|
||||
|
||||
const fetchInfiniteQuery = async (endpoint: string) => {
|
||||
const url = `http://localhost:5000/trigger/${endpoint}`;
|
||||
const requestOptions: any = {
|
||||
method: "GET",
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Access-Control-Allow-Headers": "*",
|
||||
"Access-Control-Allow-Methods": "POST, GET, OPTIONS",
|
||||
"Access-Control-Allow-Credentials": true,
|
||||
"Sec-Fetch-Mode": "no-cors",
|
||||
"Sec-Fetch-Site": "same-site",
|
||||
'Content-Type': 'application/json',
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Headers': '*',
|
||||
'Access-Control-Allow-Methods': 'POST, GET, OPTIONS',
|
||||
'Access-Control-Allow-Credentials': true,
|
||||
'Sec-Fetch-Mode': 'no-cors',
|
||||
'Sec-Fetch-Site': 'same-site',
|
||||
},
|
||||
};
|
||||
try {
|
||||
const response = await fetch(url, requestOptions);
|
||||
return await response.json();
|
||||
} catch (error) {
|
||||
console.error("Error fetching transactions:", error);
|
||||
console.error('Error fetching transactions:', error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
@@ -431,19 +431,13 @@ export const useFetchInfiniteQuery = ({
|
||||
}
|
||||
return allPages.length + 1;
|
||||
};
|
||||
const {
|
||||
data,
|
||||
isLoading,
|
||||
isFetchingNextPage,
|
||||
fetchNextPage,
|
||||
isError,
|
||||
isFetching,
|
||||
} = useInfiniteQuery({
|
||||
queryKey,
|
||||
queryFn,
|
||||
getNextPageParam,
|
||||
initialPageParam: 1,
|
||||
});
|
||||
const { data, isLoading, isFetchingNextPage, fetchNextPage, isError, isFetching } =
|
||||
useInfiniteQuery({
|
||||
queryKey,
|
||||
queryFn,
|
||||
getNextPageParam,
|
||||
initialPageParam: 1,
|
||||
});
|
||||
return {
|
||||
data,
|
||||
isLoading,
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Jost:ital,wght@0,100;0,200;0,400;1,100;1,200&display=swap');
|
||||
|
||||
.root {
|
||||
background-image: var(--image-background);
|
||||
}
|
||||
|
||||
.mrt-edit-action-buttons {
|
||||
.mantine-Button-root[data-variant="subtle"] {
|
||||
color: var(--color-text-pri) !important;
|
||||
|
||||
10
src/main.tsx
10
src/main.tsx
@@ -1,7 +1,7 @@
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom/client";
|
||||
import App from "./App.tsx";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import App from './App.tsx';
|
||||
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
@@ -12,7 +12,7 @@ const queryClient = new QueryClient({
|
||||
},
|
||||
});
|
||||
|
||||
ReactDOM.createRoot(document.getElementById("root")!).render(
|
||||
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
|
||||
<React.StrictMode>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<App />
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
import { Stack } from "@mantine/core";
|
||||
import stackClasses from "../../styles/Stack.module.css";
|
||||
import { useQueryAPI } from "../../hooks/useAPI";
|
||||
import Search from "./components/Search";
|
||||
import Header from "./components/Header";
|
||||
import Applications from "./components/Applications";
|
||||
import Bookmarks from "./components/Bookmarks";
|
||||
import SettingsButton from "./components/SettingsButton";
|
||||
import { useEffect, useState } from "react";
|
||||
import "../../index.css";
|
||||
import { useLocalStorage } from "@mantine/hooks";
|
||||
import { Stack } from '@mantine/core';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useQueryAPI } from '../../hooks/useAPI';
|
||||
import stackClasses from '../../styles/Stack.module.css';
|
||||
import Applications from './components/Applications';
|
||||
import Bookmarks from './components/Bookmarks';
|
||||
import Header from './components/Header';
|
||||
import Search from './components/Search';
|
||||
import SettingsButton from './components/SettingsButton';
|
||||
import '../../index.css';
|
||||
import { useLocalStorage } from '@mantine/hooks';
|
||||
|
||||
export default function Homepage({ theme }: any) {
|
||||
const { data, isFetching } = useQueryAPI({ endpoint: "api/messages" });
|
||||
const [displayedGreeting, setDisplayedGreeting] = useState("");
|
||||
const { data, isFetching } = useQueryAPI({ endpoint: 'api/messages' });
|
||||
const [displayedGreeting, setDisplayedGreeting] = useState('');
|
||||
const [contentType, setContentType] = useLocalStorage<any>({
|
||||
key: "contenttype",
|
||||
defaultValue: "All",
|
||||
key: 'contenttype',
|
||||
defaultValue: 'All',
|
||||
});
|
||||
function date() {
|
||||
const currentDate = new Date();
|
||||
const dateOptions: Intl.DateTimeFormatOptions = {
|
||||
weekday: "long",
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
weekday: 'long',
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
};
|
||||
const date = currentDate.toLocaleDateString("en-GB", dateOptions);
|
||||
const date = currentDate.toLocaleDateString('en-GB', dateOptions);
|
||||
return date;
|
||||
}
|
||||
function greet(list: any) {
|
||||
@@ -35,7 +35,7 @@ export default function Homepage({ theme }: any) {
|
||||
let timeBased: any = [];
|
||||
let easterEggs: any = [];
|
||||
for (const l of list) {
|
||||
if (l.easteregg === "N") {
|
||||
if (l.easteregg === 'N') {
|
||||
timeBased = timeBased.concat(l);
|
||||
} else {
|
||||
easterEggs = easterEggs.concat(l);
|
||||
@@ -54,7 +54,7 @@ export default function Homepage({ theme }: any) {
|
||||
}, [isFetching]);
|
||||
|
||||
return (
|
||||
<Stack gap={0} className={stackClasses.containerStack} justify="center">
|
||||
<Stack gap={0} className={stackClasses.containerStack} justify='center'>
|
||||
<Search />
|
||||
<Header date={date()} greet={displayedGreeting} />
|
||||
<Applications contentType={contentType} />
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
import { Icon } from "@iconify/react";
|
||||
import { Box, Stack, Text } from "@mantine/core";
|
||||
import { useState } from "react";
|
||||
import stacks from "../../../styles/Stack.module.css";
|
||||
import texts from "../../../styles/Text.module.css";
|
||||
import { Icon } from '@iconify/react';
|
||||
import { Box, Stack, Text } from '@mantine/core';
|
||||
import { useState } from 'react';
|
||||
import stacks from '../../../styles/Stack.module.css';
|
||||
import texts from '../../../styles/Text.module.css';
|
||||
|
||||
function AppItem({ url, icon, name }: any) {
|
||||
const [textDecoration, setTextDecoration] = useState<string>("none");
|
||||
const [textDecoration, setTextDecoration] = useState<string>('none');
|
||||
|
||||
return (
|
||||
<Box
|
||||
component="a"
|
||||
component='a'
|
||||
href={`https://${url}`}
|
||||
onMouseOver={() => setTextDecoration("underline")}
|
||||
onMouseOut={() => setTextDecoration("none")}
|
||||
onMouseOver={() => setTextDecoration('underline')}
|
||||
onMouseOut={() => setTextDecoration('none')}
|
||||
className={stacks.appItemBox}
|
||||
>
|
||||
<Stack
|
||||
style={{
|
||||
height: "64px",
|
||||
marginRight: "1em",
|
||||
marginLeft: "1em",
|
||||
paddingTop: "15px",
|
||||
height: '64px',
|
||||
marginRight: '1em',
|
||||
marginLeft: '1em',
|
||||
paddingTop: '15px',
|
||||
}}
|
||||
>
|
||||
<Icon icon={`mdi:${icon}`} height={32} width={32} />
|
||||
</Stack>
|
||||
<Stack
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
justifyContent: "center",
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
flex: 1,
|
||||
overflow: "hidden",
|
||||
overflow: 'hidden',
|
||||
gap: 0,
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Stack, Text } from "@mantine/core";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useQueryAPI } from "../../../hooks/useAPI";
|
||||
import texts from "../../../styles/Text.module.css";
|
||||
import AppItem from "./AppItem";
|
||||
import { Stack, Text } from '@mantine/core';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useQueryAPI } from '../../../hooks/useAPI';
|
||||
import texts from '../../../styles/Text.module.css';
|
||||
import AppItem from './AppItem';
|
||||
|
||||
function Applications({ contentType }: any) {
|
||||
const { data, isFetching } = useQueryAPI({ endpoint: "api/apps" });
|
||||
const { data, isFetching } = useQueryAPI({ endpoint: 'api/apps' });
|
||||
const [applications, setApplications] = useState([]);
|
||||
useEffect(() => {
|
||||
if (!isFetching) {
|
||||
@@ -13,26 +13,26 @@ function Applications({ contentType }: any) {
|
||||
}
|
||||
}, [isFetching]);
|
||||
return (
|
||||
<Stack id="apps" style={{ gap: 0 }}>
|
||||
<Stack id='apps' style={{ gap: 0 }}>
|
||||
<Text className={texts.sectionTitle} classNames={texts}>
|
||||
Applications
|
||||
</Text>
|
||||
<Stack
|
||||
style={{
|
||||
background: "var(--color-background)",
|
||||
gap: ".25rem",
|
||||
backgroundSize: "cover",
|
||||
borderBottom: "0px solid",
|
||||
display: "grid",
|
||||
gridColumnGap: "5px",
|
||||
gridRowGap: "5px",
|
||||
gridTemplateColumns: "1fr 1fr 1fr 1fr 1fr 1fr",
|
||||
gridTemplateRows: "64px",
|
||||
paddingBottom: "var(--module-spacing)",
|
||||
background: 'var(--color-background)',
|
||||
gap: '.25rem',
|
||||
backgroundSize: 'cover',
|
||||
borderBottom: '0px solid',
|
||||
display: 'grid',
|
||||
gridColumnGap: '5px',
|
||||
gridRowGap: '5px',
|
||||
gridTemplateColumns: '1fr 1fr 1fr 1fr 1fr 1fr',
|
||||
gridTemplateRows: '64px',
|
||||
paddingBottom: 'var(--module-spacing)',
|
||||
}}
|
||||
>
|
||||
{applications?.map((item: any) => {
|
||||
if (item.category === contentType || contentType === "All")
|
||||
if (item.category === contentType || contentType === 'All')
|
||||
return (
|
||||
<AppItem
|
||||
key={item.name}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { Stack, Text } from "@mantine/core";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useQueryAPI } from "../../../hooks/useAPI";
|
||||
import texts from "../../../styles/Text.module.css";
|
||||
import LinkGroups from "./LinkGroups";
|
||||
import { Stack, Text } from '@mantine/core';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useQueryAPI } from '../../../hooks/useAPI';
|
||||
import texts from '../../../styles/Text.module.css';
|
||||
import LinkGroups from './LinkGroups';
|
||||
|
||||
function Links({ contentType }: any) {
|
||||
const { data: linkData, isFetched: linksIsFetched } = useQueryAPI({
|
||||
endpoint: "api/links",
|
||||
endpoint: 'api/links',
|
||||
});
|
||||
const { data: groupData, isFetched: groupsIsFetched } = useQueryAPI({
|
||||
endpoint: "api/categories",
|
||||
endpoint: 'api/categories',
|
||||
});
|
||||
const [bookmarks, setBookmarks] = useState([]);
|
||||
const [categories, setCategories] = useState([]);
|
||||
@@ -24,32 +24,28 @@ function Links({ contentType }: any) {
|
||||
return (
|
||||
<>
|
||||
{groupsIsFetched && linksIsFetched && categories?.length > 0 && (
|
||||
<Stack id="links" style={{ gap: 0 }}>
|
||||
<Stack id='links' style={{ gap: 0 }}>
|
||||
<Text className={texts.sectionTitle} classNames={texts}>
|
||||
Bookmarks
|
||||
</Text>
|
||||
<Stack
|
||||
style={{
|
||||
display: "grid",
|
||||
flexWrap: "nowrap",
|
||||
gridColumnGap: "20px",
|
||||
gridRowGap: "0px",
|
||||
gridTemplateColumns: "1fr 1fr 1fr 1fr 1fr",
|
||||
gridTemplateRows: "auto",
|
||||
display: 'grid',
|
||||
flexWrap: 'nowrap',
|
||||
gridColumnGap: '20px',
|
||||
gridRowGap: '0px',
|
||||
gridTemplateColumns: '1fr 1fr 1fr 1fr 1fr',
|
||||
gridTemplateRows: 'auto',
|
||||
}}
|
||||
>
|
||||
{categories.map((category: any) => {
|
||||
if (
|
||||
category.column_filter === contentType ||
|
||||
contentType === "All"
|
||||
) {
|
||||
if (category.column_filter === contentType || contentType === 'All') {
|
||||
return (
|
||||
<LinkGroups
|
||||
key={category.id}
|
||||
category={category.category_name}
|
||||
links={bookmarks.filter(
|
||||
(bookmark: any) =>
|
||||
bookmark.category === category.category_index,
|
||||
(bookmark: any) => bookmark.category === category.category_index,
|
||||
)}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Stack, Text } from "@mantine/core";
|
||||
import { useEffect, useState } from "react";
|
||||
import { textClasses } from "../../../styles";
|
||||
import { Stack, Text } from '@mantine/core';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { textClasses } from '../../../styles';
|
||||
|
||||
function Header({ greet, date }: any) {
|
||||
const [time, setTime] = useState(new Date());
|
||||
@@ -22,18 +22,18 @@ function Header({ greet, date }: any) {
|
||||
return (
|
||||
<Stack
|
||||
style={{
|
||||
borderBottom: "0px solid",
|
||||
zIndex: "1",
|
||||
clear: "both",
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
borderBottom: '0px solid',
|
||||
zIndex: '1',
|
||||
clear: 'both',
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
gap: 0,
|
||||
}}
|
||||
>
|
||||
<Stack
|
||||
style={{
|
||||
display: "grid",
|
||||
width: "100%",
|
||||
display: 'grid',
|
||||
width: '100%',
|
||||
}}
|
||||
>
|
||||
<Text className={textClasses.greeting} classNames={textClasses}>
|
||||
@@ -42,27 +42,27 @@ function Header({ greet, date }: any) {
|
||||
</Stack>
|
||||
<Stack
|
||||
style={{
|
||||
display: "flex",
|
||||
float: "right",
|
||||
justifyContent: "right",
|
||||
width: "auto",
|
||||
display: 'flex',
|
||||
float: 'right',
|
||||
justifyContent: 'right',
|
||||
width: 'auto',
|
||||
gap: 0,
|
||||
}}
|
||||
>
|
||||
<Text
|
||||
className={textClasses.dateTime}
|
||||
classNames={textClasses}
|
||||
style={{ width: "max-content" }}
|
||||
style={{ width: 'max-content' }}
|
||||
>
|
||||
{date}
|
||||
</Text>
|
||||
<Text
|
||||
component="h2"
|
||||
component='h2'
|
||||
className={textClasses.dateTime}
|
||||
classNames={textClasses}
|
||||
style={{
|
||||
justifyContent: "right",
|
||||
display: "grid",
|
||||
justifyContent: 'right',
|
||||
display: 'grid',
|
||||
}}
|
||||
>
|
||||
{`${
|
||||
@@ -71,7 +71,7 @@ function Header({ greet, date }: any) {
|
||||
: time.getHours() > 12
|
||||
? time.getHours() - 12
|
||||
: time.getHours()
|
||||
}:${fixDigits(time.getMinutes())} ${time.getHours() >= 12 ? "PM" : "AM"}`}
|
||||
}:${fixDigits(time.getMinutes())} ${time.getHours() >= 12 ? 'PM' : 'AM'}`}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Stack>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { Stack, Text } from "@mantine/core";
|
||||
import texts from "../../../styles/Text.module.css";
|
||||
import LinkItem from "./LinkItem";
|
||||
import { Stack, Text } from '@mantine/core';
|
||||
import texts from '../../../styles/Text.module.css';
|
||||
import LinkItem from './LinkItem';
|
||||
|
||||
function LinkGroups({ links, category }: any) {
|
||||
return (
|
||||
<Stack
|
||||
style={{
|
||||
marginBottom: "0em",
|
||||
display: "block",
|
||||
lineHeight: "1.5rem",
|
||||
marginBottom: '0em',
|
||||
display: 'block',
|
||||
lineHeight: '1.5rem',
|
||||
}}
|
||||
>
|
||||
<Text className={texts.linkCategory} classNames={texts}>
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
import { Text } from "@mantine/core";
|
||||
import texts from "../../../styles/Text.module.css";
|
||||
import { Text } from '@mantine/core';
|
||||
import texts from '../../../styles/Text.module.css';
|
||||
|
||||
function LinkItem({ link }: any) {
|
||||
return (
|
||||
<Text
|
||||
className={texts.linkItem}
|
||||
classNames={texts}
|
||||
component="a"
|
||||
href={link.url}
|
||||
>
|
||||
<Text className={texts.linkItem} classNames={texts} component='a' href={link.url}>
|
||||
{link.name}
|
||||
</Text>
|
||||
);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import Messages from "../../../components/Messages";
|
||||
import useQueryAPI from "../../../hooks/useAPI";
|
||||
import { useEffect, useState } from 'react';
|
||||
import Messages from '../../../components/Messages';
|
||||
import useQueryAPI from '../../../hooks/useAPI';
|
||||
|
||||
function MessageInfo() {
|
||||
const messageData = useQueryAPI({ endpoint: "api/messages" });
|
||||
const messageData = useQueryAPI({ endpoint: 'api/messages' });
|
||||
const [greetings, setGreetings] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -15,7 +15,7 @@ function MessageInfo() {
|
||||
return (
|
||||
<>
|
||||
{greetings && (
|
||||
<div id="messageForm">
|
||||
<div id='messageForm'>
|
||||
{greetings.map((greeting, index) => (
|
||||
<Messages
|
||||
key={greeting.id}
|
||||
|
||||
@@ -1,50 +1,47 @@
|
||||
import { Stack, TextInput } from "@mantine/core";
|
||||
import { textInputClasses } from "../../../styles";
|
||||
import { useQueryAPI } from "../../../hooks";
|
||||
import { useState } from "react";
|
||||
import { Stack, TextInput } from '@mantine/core';
|
||||
import { useState } from 'react';
|
||||
import { useQueryAPI } from '../../../hooks';
|
||||
import { textInputClasses } from '../../../styles';
|
||||
|
||||
export default function Search() {
|
||||
const { data: providers } = useQueryAPI({ endpoint: "api/providers" });
|
||||
const { data: providers } = useQueryAPI({ endpoint: 'api/providers' });
|
||||
|
||||
const [providerLabel, setProviderLabel] = useState("Google Search");
|
||||
const [providerURL, setProviderURL] = useState(
|
||||
"https://www.google.com/search?q=",
|
||||
);
|
||||
const [value, setValue] = useState("");
|
||||
const [providerLabel, setProviderLabel] = useState('Google Search');
|
||||
const [providerURL, setProviderURL] = useState('https://www.google.com/search?q=');
|
||||
const [value, setValue] = useState('');
|
||||
|
||||
const handleKeyPress = (item: any) => {
|
||||
let option = ''
|
||||
let subtext = ''
|
||||
if (item.target.value.startsWith("/")) {
|
||||
let option = '';
|
||||
let subtext = '';
|
||||
if (item.target.value.startsWith('/')) {
|
||||
option =
|
||||
item.target.value.substr(1, item.target.value.indexOf(" ") - 1) ||
|
||||
item.target.value.substr(1);
|
||||
item.target.value.substr(1, item.target.value.indexOf(' ') - 1) ||
|
||||
item.target.value.substr(1);
|
||||
subtext = item.target.value.substr(2 + option.length);
|
||||
} else {
|
||||
subtext = item.target.value;
|
||||
}
|
||||
if (item.key === "Enter") {
|
||||
if (item.target.value.startsWith("/")) {
|
||||
open(`${providerURL}${subtext}`, "_self");
|
||||
if (item.key === 'Enter') {
|
||||
if (item.target.value.startsWith('/')) {
|
||||
open(`${providerURL}${subtext}`, '_self');
|
||||
} else if (validURL(item.target.value)) {
|
||||
if (containsProtocol(item.target.value))
|
||||
window.location = item.target.value;
|
||||
else open(`https://${item.target.value}`, "_self");
|
||||
if (containsProtocol(item.target.value)) window.location = item.target.value;
|
||||
else open(`https://${item.target.value}`, '_self');
|
||||
} else {
|
||||
open(`${providerURL}${subtext}`, "_self");
|
||||
open(`${providerURL}${subtext}`, '_self');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function validURL(str: any) {
|
||||
const pattern = new RegExp(
|
||||
"^(https?:\\/\\/)?" + // protocol
|
||||
"((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|" + // domain name
|
||||
"((\\d{1,3}\\.){3}\\d{1,3}))" + // OR ip (v4) address
|
||||
"(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*" + // port and path
|
||||
"(\\?[;&a-z\\d%_.~+=-]*)?" + // query string
|
||||
"(\\#[-a-z\\d_]*)?$",
|
||||
"i",
|
||||
'^(https?:\\/\\/)?' + // protocol
|
||||
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name
|
||||
'((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
|
||||
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path
|
||||
'(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
|
||||
'(\\#[-a-z\\d_]*)?$',
|
||||
'i',
|
||||
); // fragment locator
|
||||
return !!pattern.test(str);
|
||||
}
|
||||
@@ -56,37 +53,37 @@ export default function Search() {
|
||||
return (
|
||||
<Stack
|
||||
style={{
|
||||
height: "100px",
|
||||
backgroundColor: "transparent",
|
||||
textAlign: "center",
|
||||
position: "relative",
|
||||
padding: ".3em",
|
||||
display: "inline-block",
|
||||
height: '100px',
|
||||
backgroundColor: 'transparent',
|
||||
textAlign: 'center',
|
||||
position: 'relative',
|
||||
padding: '.3em',
|
||||
display: 'inline-block',
|
||||
gap: 0,
|
||||
}}
|
||||
>
|
||||
<TextInput
|
||||
className={textInputClasses.search}
|
||||
classNames={textInputClasses}
|
||||
spellCheck="true"
|
||||
spellCheck='true'
|
||||
leftSection={providerLabel}
|
||||
value={value}
|
||||
data-active={value !== ''}
|
||||
onChange={(item: any) => {
|
||||
setValue(item.currentTarget.value)
|
||||
if (item.target.value.startsWith("/")) {
|
||||
setValue(item.currentTarget.value);
|
||||
if (item.target.value.startsWith('/')) {
|
||||
const provider = providers?.find(
|
||||
(p: any) => p.prefix === item.target.value.split(" ")[0],
|
||||
)
|
||||
setProviderLabel(provider?.name || "Invalid Search");
|
||||
(p: any) => p.prefix === item.target.value.split(' ')[0],
|
||||
);
|
||||
setProviderLabel(provider?.name || 'Invalid Search');
|
||||
setProviderURL(provider?.url);
|
||||
} else {
|
||||
setProviderLabel("Google Search");
|
||||
setProviderURL("https://www.google.com/search?q=");
|
||||
setProviderLabel('Google Search');
|
||||
setProviderURL('https://www.google.com/search?q=');
|
||||
}
|
||||
}}
|
||||
onKeyUp={(item: any) => {
|
||||
if(providerLabel !== "Invalid Search"){
|
||||
if (providerLabel !== 'Invalid Search') {
|
||||
handleKeyPress(item);
|
||||
}
|
||||
}}
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
import { Button, Menu, NavLink, Select } from "@mantine/core";
|
||||
import { useEffect, useState } from "react";
|
||||
import { FiMenu, FiMonitor } from "react-icons/fi";
|
||||
import { useQueryAPI } from "../../../hooks/useAPI";
|
||||
import button from "../../../styles/Button.module.css";
|
||||
import menu from "../../../styles/Menu.module.css";
|
||||
import navLink from "../../../styles/NavLink.module.css";
|
||||
import selectClasses from "../../../styles/Select.module.css";
|
||||
import { Button, Menu, NavLink, Select } from '@mantine/core';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { FiMenu, FiMonitor } from 'react-icons/fi';
|
||||
import { useQueryAPI } from '../../../hooks/useAPI';
|
||||
import button from '../../../styles/Button.module.css';
|
||||
import menu from '../../../styles/Menu.module.css';
|
||||
import navLink from '../../../styles/NavLink.module.css';
|
||||
import selectClasses from '../../../styles/Select.module.css';
|
||||
|
||||
function SettingsButton({ contentType, setContentType, theme }: any) {
|
||||
const { data, isFetched } = useQueryAPI({ endpoint: "api/appCategories" });
|
||||
const [categories, setCategories] = useState([
|
||||
{ value: "All", label: "All" },
|
||||
]);
|
||||
const { data, isFetched } = useQueryAPI({ endpoint: 'api/appCategories' });
|
||||
const [categories, setCategories] = useState([{ value: 'All', label: 'All' }]);
|
||||
|
||||
useEffect(() => {
|
||||
if (data) {
|
||||
@@ -19,20 +17,20 @@ function SettingsButton({ contentType, setContentType, theme }: 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);
|
||||
}
|
||||
}, [data, isFetched]);
|
||||
|
||||
function runWakeCommand() {
|
||||
const requestOptions = {
|
||||
method: "GET",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
method: 'GET',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
};
|
||||
fetch("/trigger/api/wakeDakota", requestOptions);
|
||||
fetch('/trigger/api/wakeDakota', requestOptions);
|
||||
}
|
||||
return (
|
||||
<Menu withinPortal={false} withArrow shadow="md" position="top">
|
||||
<Menu withinPortal={false} withArrow shadow='md' position='top'>
|
||||
<Menu.Target>
|
||||
<Button className={button.settingsButton} classNames={button}>
|
||||
<FiMenu />
|
||||
@@ -40,19 +38,19 @@ function SettingsButton({ contentType, setContentType, theme }: any) {
|
||||
</Menu.Target>
|
||||
<Menu.Dropdown className={menu.dropdown}>
|
||||
<NavLink
|
||||
label="Settings"
|
||||
component="a"
|
||||
href="/trigger/settings"
|
||||
label='Settings'
|
||||
component='a'
|
||||
href='/trigger/settings'
|
||||
className={navLink.defaultNavLink}
|
||||
classNames={navLink}
|
||||
/>
|
||||
<NavLink
|
||||
label="Quick Actions"
|
||||
label='Quick Actions'
|
||||
className={navLink.defaultNavLink}
|
||||
classNames={navLink}
|
||||
>
|
||||
<NavLink
|
||||
label="Wake Dakota"
|
||||
label='Wake Dakota'
|
||||
leftSection={<FiMonitor />}
|
||||
onClick={() => runWakeCommand()}
|
||||
className={navLink.defaultNavLink}
|
||||
@@ -60,7 +58,7 @@ function SettingsButton({ contentType, setContentType, theme }: any) {
|
||||
/>
|
||||
</NavLink>
|
||||
<Select
|
||||
label="Homepage Filter"
|
||||
label='Homepage Filter'
|
||||
data={categories ?? []}
|
||||
defaultValue={contentType}
|
||||
withCheckIcon={false}
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
import { ActionIcon, Group, Stack, Tabs, Text } from "@mantine/core";
|
||||
import tabClasses from "../../styles/Tabs.module.css";
|
||||
import Personalization from "./components/Personalization";
|
||||
import { FiArrowLeftCircle } from "react-icons/fi";
|
||||
import { actionIconClasses, textClasses } from "../../styles";
|
||||
import Messages from "./components/Messages";
|
||||
import Applications from "./components/Applications";
|
||||
import Bookmarks from "./components/Bookmarks";
|
||||
import Categories from "./components/Categories";
|
||||
import SearchProviders from "./components/SearchProviders";
|
||||
import Themes from "./components/Themes";
|
||||
import { ActionIcon, Group, Stack, Tabs, Text } from '@mantine/core';
|
||||
import { FiArrowLeftCircle } from 'react-icons/fi';
|
||||
import { actionIconClasses, textClasses } from '../../styles';
|
||||
import tabClasses from '../../styles/Tabs.module.css';
|
||||
import Applications from './components/Applications';
|
||||
import Bookmarks from './components/Bookmarks';
|
||||
import Categories from './components/Categories';
|
||||
import Messages from './components/Messages';
|
||||
import Personalization from './components/Personalization';
|
||||
import SearchProviders from './components/SearchProviders';
|
||||
import Themes from './components/Themes';
|
||||
|
||||
function Settings({ theme }: any) {
|
||||
return (
|
||||
<Stack h={"100vh"} px={"2rem"} bg={"var(--color-background)"}>
|
||||
<Stack h={'100vh'} px={'2rem'} bg={'var(--color-background)'}>
|
||||
<Group gap={0}>
|
||||
<ActionIcon
|
||||
className={actionIconClasses.backButton}
|
||||
classNames={actionIconClasses}
|
||||
component="a"
|
||||
href="/trigger"
|
||||
component='a'
|
||||
href='/trigger'
|
||||
>
|
||||
<FiArrowLeftCircle />
|
||||
</ActionIcon>
|
||||
@@ -27,39 +27,39 @@ function Settings({ theme }: any) {
|
||||
</Text>
|
||||
</Group>
|
||||
<Tabs
|
||||
orientation="vertical"
|
||||
defaultValue={"personalization"}
|
||||
orientation='vertical'
|
||||
defaultValue={'personalization'}
|
||||
className={tabClasses.settingsTabs}
|
||||
classNames={tabClasses}
|
||||
>
|
||||
<Tabs.List>
|
||||
<Tabs.Tab value="personalization">Personal Info</Tabs.Tab>
|
||||
<Tabs.Tab value="messages">Messages</Tabs.Tab>
|
||||
<Tabs.Tab value="applications">Applications</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="providers">Search Providers</Tabs.Tab>
|
||||
<Tabs.Tab value='personalization'>Personal Info</Tabs.Tab>
|
||||
<Tabs.Tab value='messages'>Messages</Tabs.Tab>
|
||||
<Tabs.Tab value='applications'>Applications</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='providers'>Search Providers</Tabs.Tab>
|
||||
</Tabs.List>
|
||||
<Tabs.Panel value="personalization">
|
||||
<Tabs.Panel value='personalization'>
|
||||
<Personalization />
|
||||
</Tabs.Panel>
|
||||
<Tabs.Panel value="messages">
|
||||
<Tabs.Panel value='messages'>
|
||||
<Messages />
|
||||
</Tabs.Panel>
|
||||
<Tabs.Panel value="applications">
|
||||
<Tabs.Panel value='applications'>
|
||||
<Applications />
|
||||
</Tabs.Panel>
|
||||
<Tabs.Panel value="bookmarks">
|
||||
<Tabs.Panel value='bookmarks'>
|
||||
<Bookmarks />
|
||||
</Tabs.Panel>
|
||||
<Tabs.Panel value="bookmarksCategories">
|
||||
<Tabs.Panel value='bookmarksCategories'>
|
||||
<Categories />
|
||||
</Tabs.Panel>
|
||||
<Tabs.Panel value="themes">
|
||||
<Tabs.Panel value='themes'>
|
||||
<Themes theme={theme} />
|
||||
</Tabs.Panel>
|
||||
<Tabs.Panel value="providers">
|
||||
<Tabs.Panel value='providers'>
|
||||
<SearchProviders />
|
||||
</Tabs.Panel>
|
||||
</Tabs>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useQueryAPI } from "../../../hooks/useAPI";
|
||||
import { DataTable } from "../../../DataTable/DataTable";
|
||||
import ApplicationColumns from "../../../DataTable/columns/ApplicationColumns";
|
||||
import { Stack, Text } from "@mantine/core";
|
||||
import { textClasses } from "../../../styles";
|
||||
import { Stack, Text } from '@mantine/core';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { DataTable } from '../../../DataTable/DataTable';
|
||||
import ApplicationColumns from '../../../DataTable/columns/ApplicationColumns';
|
||||
import { useQueryAPI } from '../../../hooks/useAPI';
|
||||
import { textClasses } from '../../../styles';
|
||||
|
||||
const ApplicationSettings = () => {
|
||||
const endpoint = "api/apps";
|
||||
const endpoint = 'api/apps';
|
||||
const { data, isFetching, isLoading, isFetched } = useQueryAPI({
|
||||
endpoint: endpoint,
|
||||
});
|
||||
@@ -24,7 +24,7 @@ const ApplicationSettings = () => {
|
||||
Applications
|
||||
</Text>
|
||||
<DataTable
|
||||
tableName="Applications"
|
||||
tableName='Applications'
|
||||
columns={ApplicationColumns()}
|
||||
tableData={applicationData}
|
||||
isFetching={isFetching}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useQueryAPI } from "../../../hooks/useAPI";
|
||||
import { DataTable } from "../../../DataTable/DataTable";
|
||||
import { Stack, Text } from "@mantine/core";
|
||||
import BookmarkColumns from "../../../DataTable/columns/BookmarkColumns";
|
||||
import { textClasses } from "../../../styles";
|
||||
import { Stack, Text } from '@mantine/core';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { DataTable } from '../../../DataTable/DataTable';
|
||||
import BookmarkColumns from '../../../DataTable/columns/BookmarkColumns';
|
||||
import { useQueryAPI } from '../../../hooks/useAPI';
|
||||
import { textClasses } from '../../../styles';
|
||||
const BookmarkSettings = () => {
|
||||
const endpoint = "api/links";
|
||||
const endpoint = 'api/links';
|
||||
const { data, isFetching, isLoading, isFetched } = useQueryAPI({
|
||||
endpoint: endpoint,
|
||||
});
|
||||
@@ -14,7 +14,7 @@ const BookmarkSettings = () => {
|
||||
isFetching: groupDataisFetching,
|
||||
isLoading: groupDataisLoading,
|
||||
isFetched: groupDataisFetched,
|
||||
} = useQueryAPI({ endpoint: "api/categories" });
|
||||
} = useQueryAPI({ endpoint: 'api/categories' });
|
||||
const [bookmarkData, setBookmarkData] = useState<any>([]);
|
||||
const [groups, setGroups] = useState([]);
|
||||
const [fullyFetched, setFullyFetched] = useState(false);
|
||||
@@ -41,7 +41,7 @@ const BookmarkSettings = () => {
|
||||
Bookmarks
|
||||
</Text>
|
||||
<DataTable
|
||||
tableName="Applications"
|
||||
tableName='Applications'
|
||||
columns={BookmarkColumns(groups, groupData)}
|
||||
tableData={bookmarkData}
|
||||
isFetching={isFetching}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useQueryAPI } from "../../../hooks/useAPI";
|
||||
import { DataTable } from "../../../DataTable/DataTable";
|
||||
import CategoryColumns from "../../../DataTable/columns/CategoryColumns";
|
||||
import { Stack, Text } from "@mantine/core";
|
||||
import { textClasses } from "../../../styles";
|
||||
import { Stack, Text } from '@mantine/core';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { DataTable } from '../../../DataTable/DataTable';
|
||||
import CategoryColumns from '../../../DataTable/columns/CategoryColumns';
|
||||
import { useQueryAPI } from '../../../hooks/useAPI';
|
||||
import { textClasses } from '../../../styles';
|
||||
const CategorySettings = () => {
|
||||
const endpoint = "api/categories";
|
||||
const endpoint = 'api/categories';
|
||||
const { data, isFetching, isLoading, isFetched } = useQueryAPI({
|
||||
endpoint: endpoint,
|
||||
});
|
||||
@@ -23,7 +23,7 @@ const CategorySettings = () => {
|
||||
Categories
|
||||
</Text>
|
||||
<DataTable
|
||||
tableName="Categories"
|
||||
tableName='Categories'
|
||||
columns={CategoryColumns()}
|
||||
tableData={categoryData}
|
||||
isFetching={isFetching}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useQueryAPI } from "../../../hooks/useAPI";
|
||||
import { DataTable } from "../../../DataTable/DataTable";
|
||||
import MessagesColumns from "../../../DataTable/columns/MessagesColumns";
|
||||
import { Stack, Text } from "@mantine/core";
|
||||
import { textClasses } from "../../../styles";
|
||||
import { Stack, Text } from '@mantine/core';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { DataTable } from '../../../DataTable/DataTable';
|
||||
import MessagesColumns from '../../../DataTable/columns/MessagesColumns';
|
||||
import { useQueryAPI } from '../../../hooks/useAPI';
|
||||
import { textClasses } from '../../../styles';
|
||||
const MessageSettings = () => {
|
||||
const endpoint = "api/messages";
|
||||
const endpoint = 'api/messages';
|
||||
const { data, isFetching, isLoading, isFetched } = useQueryAPI({
|
||||
endpoint: endpoint,
|
||||
});
|
||||
@@ -23,7 +23,7 @@ const MessageSettings = () => {
|
||||
Messages
|
||||
</Text>
|
||||
<DataTable
|
||||
tableName="Messages"
|
||||
tableName='Messages'
|
||||
columns={MessagesColumns()}
|
||||
tableData={messageData}
|
||||
isFetching={isFetching}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useQueryAPI } from "../../../hooks/useAPI";
|
||||
import { DataTable } from "../../../DataTable/DataTable";
|
||||
import PersonalizationColumns from "../../../DataTable/columns/PersonalizationColumns";
|
||||
import { textClasses } from "../../../styles";
|
||||
import { Text } from "@mantine/core";
|
||||
import { Text } from '@mantine/core';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { DataTable } from '../../../DataTable/DataTable';
|
||||
import PersonalizationColumns from '../../../DataTable/columns/PersonalizationColumns';
|
||||
import { useQueryAPI } from '../../../hooks/useAPI';
|
||||
import { textClasses } from '../../../styles';
|
||||
const PersonalizationSettings = () => {
|
||||
const endpoint = "api/personaldata";
|
||||
const endpoint = 'api/personaldata';
|
||||
const { data, isFetching, isLoading, isFetched } = useQueryAPI({
|
||||
endpoint: endpoint,
|
||||
});
|
||||
@@ -23,7 +23,7 @@ const PersonalizationSettings = () => {
|
||||
Personalization
|
||||
</Text>
|
||||
<DataTable
|
||||
tableName="Personalization"
|
||||
tableName='Personalization'
|
||||
columns={PersonalizationColumns()}
|
||||
tableData={personalData}
|
||||
isFetching={isFetching}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useQueryAPI } from "../../../hooks/useAPI";
|
||||
import { DataTable } from "../../../DataTable/DataTable";
|
||||
import SearchProviderColumns from "../../../DataTable/columns/SearchProviderColumns";
|
||||
import { Stack, Text } from "@mantine/core";
|
||||
import { textClasses } from "../../../styles";
|
||||
import { Stack, Text } from '@mantine/core';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { DataTable } from '../../../DataTable/DataTable';
|
||||
import SearchProviderColumns from '../../../DataTable/columns/SearchProviderColumns';
|
||||
import { useQueryAPI } from '../../../hooks/useAPI';
|
||||
import { textClasses } from '../../../styles';
|
||||
const SearchProviderSettings = () => {
|
||||
const endpoint = "api/providers";
|
||||
const endpoint = 'api/providers';
|
||||
const { data, isFetching, isLoading, isFetched } = useQueryAPI({
|
||||
endpoint: endpoint,
|
||||
});
|
||||
@@ -23,7 +23,7 @@ const SearchProviderSettings = () => {
|
||||
Search Providers
|
||||
</Text>
|
||||
<DataTable
|
||||
tableName="Categories"
|
||||
tableName='Categories'
|
||||
columns={SearchProviderColumns()}
|
||||
tableData={providerData}
|
||||
isFetching={isFetching}
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
import { Icon } from "@iconify/react/dist/iconify.js";
|
||||
import { Stack, Group, Text, Box } from "@mantine/core";
|
||||
import { useState } from "react";
|
||||
import { stackClasses } from "../../../styles";
|
||||
import { Icon } from '@iconify/react/dist/iconify.js';
|
||||
import { Box, Group, Stack, Text } from '@mantine/core';
|
||||
import { useState } from 'react';
|
||||
import { stackClasses } from '../../../styles';
|
||||
|
||||
export default function ThemeModalContent({ selectedTheme }: any) {
|
||||
const ExampleApp = (previewTheme: any) => {
|
||||
const [textDecoration, setTextDecoration] = useState<string>("none");
|
||||
const [textDecoration, setTextDecoration] = useState<string>('none');
|
||||
return (
|
||||
<Box
|
||||
component="a"
|
||||
onMouseOver={() => setTextDecoration("underline")}
|
||||
onMouseOut={() => setTextDecoration("none")}
|
||||
component='a'
|
||||
onMouseOver={() => setTextDecoration('underline')}
|
||||
onMouseOut={() => setTextDecoration('none')}
|
||||
className={stackClasses.appItemBox}
|
||||
>
|
||||
<Stack
|
||||
style={{
|
||||
height: "64px",
|
||||
marginRight: "1em",
|
||||
marginLeft: "1em",
|
||||
paddingTop: "15px",
|
||||
height: '64px',
|
||||
marginRight: '1em',
|
||||
marginLeft: '1em',
|
||||
paddingTop: '15px',
|
||||
}}
|
||||
>
|
||||
<Icon
|
||||
style={{ color: previewTheme.theme.colortextpri }}
|
||||
icon={`mdi:check`}
|
||||
icon={'mdi:check'}
|
||||
height={32}
|
||||
width={32}
|
||||
/>
|
||||
</Stack>
|
||||
<Stack
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
justifyContent: "center",
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
flex: 1,
|
||||
overflow: "hidden",
|
||||
overflow: 'hidden',
|
||||
gap: 0,
|
||||
}}
|
||||
>
|
||||
@@ -42,28 +42,28 @@ export default function ThemeModalContent({ selectedTheme }: any) {
|
||||
style={{
|
||||
fontWeight: 400,
|
||||
fontSize: 11,
|
||||
fontStyle: "normal",
|
||||
fontStyle: 'normal',
|
||||
color: previewTheme.theme.colortextpri,
|
||||
fontFamily:
|
||||
"-apple-system, Jost, BlinkMacSystemFont, Helvetica Neue, Roboto, sans-serif !important",
|
||||
'-apple-system, Jost, BlinkMacSystemFont, Helvetica Neue, Roboto, sans-serif !important',
|
||||
margin: 0,
|
||||
}}
|
||||
>
|
||||
{"Example App"}
|
||||
{'Example App'}
|
||||
</Text>
|
||||
<Text
|
||||
style={{
|
||||
fontWeight: 400,
|
||||
fontSize: 11,
|
||||
fontStyle: "italic",
|
||||
fontStyle: 'italic',
|
||||
color: previewTheme.theme.colortextacc,
|
||||
fontFamily:
|
||||
"-apple-system, Jost, BlinkMacSystemFont, Helvetica Neue, Roboto, sans-serif !important",
|
||||
'-apple-system, Jost, BlinkMacSystemFont, Helvetica Neue, Roboto, sans-serif !important',
|
||||
margin: 0,
|
||||
textDecoration: textDecoration,
|
||||
}}
|
||||
>
|
||||
{"https://www.example.com"}
|
||||
{'https://www.example.com'}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Box>
|
||||
@@ -72,31 +72,31 @@ export default function ThemeModalContent({ selectedTheme }: any) {
|
||||
return (
|
||||
<Stack
|
||||
style={{
|
||||
width: "100%",
|
||||
width: '100%',
|
||||
backgroundColor: selectedTheme.colorbackground,
|
||||
borderRadius: "10px",
|
||||
borderRadius: '10px',
|
||||
}}
|
||||
>
|
||||
<Group
|
||||
justify="center"
|
||||
justify='center'
|
||||
style={{
|
||||
color: selectedTheme.colortextpri,
|
||||
paddingTop: "1rem",
|
||||
paddingTop: '1rem',
|
||||
}}
|
||||
>
|
||||
{selectedTheme.name}
|
||||
</Group>
|
||||
<Text
|
||||
pl={"1.5rem"}
|
||||
pl={'1.5rem'}
|
||||
style={{
|
||||
textDecoration: "underline",
|
||||
fontSize: "20px",
|
||||
textDecoration: 'underline',
|
||||
fontSize: '20px',
|
||||
fontWeight: 200,
|
||||
fontStyle: "italic",
|
||||
height: "10px",
|
||||
textTransform: "uppercase",
|
||||
marginTop: "20px",
|
||||
marginBottom: "20px",
|
||||
fontStyle: 'italic',
|
||||
height: '10px',
|
||||
textTransform: 'uppercase',
|
||||
marginTop: '20px',
|
||||
marginBottom: '20px',
|
||||
color: selectedTheme.colortextpri,
|
||||
}}
|
||||
>
|
||||
@@ -105,18 +105,18 @@ export default function ThemeModalContent({ selectedTheme }: any) {
|
||||
<Stack
|
||||
style={{
|
||||
background: selectedTheme.colorbackground,
|
||||
gap: ".25rem",
|
||||
backgroundSize: "cover",
|
||||
borderBottom: "0px solid",
|
||||
display: "grid",
|
||||
gridColumnGap: "5px",
|
||||
gridRowGap: "5px",
|
||||
gridTemplateColumns: "1fr 1fr 1fr",
|
||||
gridTemplateRows: "64px",
|
||||
padding: "1rem",
|
||||
paddingTop: "0rem",
|
||||
justifyContent: "center",
|
||||
alignContent: "center",
|
||||
gap: '.25rem',
|
||||
backgroundSize: 'cover',
|
||||
borderBottom: '0px solid',
|
||||
display: 'grid',
|
||||
gridColumnGap: '5px',
|
||||
gridRowGap: '5px',
|
||||
gridTemplateColumns: '1fr 1fr 1fr',
|
||||
gridTemplateRows: '64px',
|
||||
padding: '1rem',
|
||||
paddingTop: '0rem',
|
||||
justifyContent: 'center',
|
||||
alignContent: 'center',
|
||||
}}
|
||||
>
|
||||
<ExampleApp theme={selectedTheme} />
|
||||
@@ -124,16 +124,16 @@ export default function ThemeModalContent({ selectedTheme }: any) {
|
||||
<ExampleApp theme={selectedTheme} />
|
||||
</Stack>
|
||||
<Text
|
||||
pl={"1.5rem"}
|
||||
pl={'1.5rem'}
|
||||
style={{
|
||||
textDecoration: "underline",
|
||||
fontSize: "20px",
|
||||
textDecoration: 'underline',
|
||||
fontSize: '20px',
|
||||
fontWeight: 200,
|
||||
fontStyle: "italic",
|
||||
height: "10px",
|
||||
textTransform: "uppercase",
|
||||
marginTop: "20px",
|
||||
marginBottom: "20px",
|
||||
fontStyle: 'italic',
|
||||
height: '10px',
|
||||
textTransform: 'uppercase',
|
||||
marginTop: '20px',
|
||||
marginBottom: '20px',
|
||||
color: selectedTheme.colortextpri,
|
||||
}}
|
||||
>
|
||||
@@ -141,107 +141,107 @@ export default function ThemeModalContent({ selectedTheme }: any) {
|
||||
</Text>
|
||||
<Stack
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
flexWrap: "nowrap",
|
||||
gridColumnGap: "20px",
|
||||
gridRowGap: "0px",
|
||||
gridTemplateColumns: "1fr 1fr 1fr 1fr 1fr",
|
||||
gridTemplateRows: "auto",
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
flexWrap: 'nowrap',
|
||||
gridColumnGap: '20px',
|
||||
gridRowGap: '0px',
|
||||
gridTemplateColumns: '1fr 1fr 1fr 1fr 1fr',
|
||||
gridTemplateRows: 'auto',
|
||||
}}
|
||||
>
|
||||
<Stack
|
||||
style={{
|
||||
width: "100%",
|
||||
marginBottom: "0em",
|
||||
display: "block",
|
||||
lineHeight: "1.5rem",
|
||||
padding: "1rem",
|
||||
paddingTop: "0rem",
|
||||
width: '100%',
|
||||
marginBottom: '0em',
|
||||
display: 'block',
|
||||
lineHeight: '1.5rem',
|
||||
padding: '1rem',
|
||||
paddingTop: '0rem',
|
||||
}}
|
||||
>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: "14px",
|
||||
fontSize: '14px',
|
||||
fontWeight: 400,
|
||||
height: "10px",
|
||||
width: "auto",
|
||||
height: '10px',
|
||||
width: 'auto',
|
||||
color: selectedTheme.colortextacc,
|
||||
textTransform: "uppercase",
|
||||
marginTop: "20px",
|
||||
marginBottom: "20px",
|
||||
textTransform: 'uppercase',
|
||||
marginTop: '20px',
|
||||
marginBottom: '20px',
|
||||
}}
|
||||
>
|
||||
Example Category
|
||||
</Text>
|
||||
<Text
|
||||
style={{
|
||||
display: "block",
|
||||
fontSize: "14px",
|
||||
display: 'block',
|
||||
fontSize: '14px',
|
||||
lineHeight: 2,
|
||||
color: selectedTheme.colortextpri,
|
||||
}}
|
||||
component="a"
|
||||
component='a'
|
||||
>
|
||||
{"Link 1"}
|
||||
{'Link 1'}
|
||||
</Text>
|
||||
<Text
|
||||
style={{
|
||||
display: "block",
|
||||
fontSize: "14px",
|
||||
display: 'block',
|
||||
fontSize: '14px',
|
||||
lineHeight: 2,
|
||||
color: selectedTheme.colortextpri,
|
||||
}}
|
||||
component="a"
|
||||
component='a'
|
||||
>
|
||||
{"Link 2"}
|
||||
{'Link 2'}
|
||||
</Text>
|
||||
</Stack>
|
||||
<Stack
|
||||
style={{
|
||||
width: "100%",
|
||||
marginBottom: "0em",
|
||||
display: "block",
|
||||
lineHeight: "1.5rem",
|
||||
padding: "1rem",
|
||||
paddingTop: "0rem",
|
||||
width: '100%',
|
||||
marginBottom: '0em',
|
||||
display: 'block',
|
||||
lineHeight: '1.5rem',
|
||||
padding: '1rem',
|
||||
paddingTop: '0rem',
|
||||
}}
|
||||
>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: "14px",
|
||||
fontSize: '14px',
|
||||
fontWeight: 400,
|
||||
height: "10px",
|
||||
width: "auto",
|
||||
height: '10px',
|
||||
width: 'auto',
|
||||
color: selectedTheme.colortextacc,
|
||||
textTransform: "uppercase",
|
||||
marginTop: "20px",
|
||||
marginBottom: "20px",
|
||||
textTransform: 'uppercase',
|
||||
marginTop: '20px',
|
||||
marginBottom: '20px',
|
||||
}}
|
||||
>
|
||||
Example Category
|
||||
</Text>
|
||||
<Text
|
||||
style={{
|
||||
display: "block",
|
||||
fontSize: "14px",
|
||||
display: 'block',
|
||||
fontSize: '14px',
|
||||
lineHeight: 2,
|
||||
color: selectedTheme.colortextpri,
|
||||
}}
|
||||
component="a"
|
||||
component='a'
|
||||
>
|
||||
{"Link 1"}
|
||||
{'Link 1'}
|
||||
</Text>
|
||||
<Text
|
||||
style={{
|
||||
display: "block",
|
||||
fontSize: "14px",
|
||||
display: 'block',
|
||||
fontSize: '14px',
|
||||
lineHeight: 2,
|
||||
color: selectedTheme.colortextpri,
|
||||
}}
|
||||
component="a"
|
||||
component='a'
|
||||
>
|
||||
{"Link 2"}
|
||||
{'Link 2'}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Stack>
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useMutationAPI, useQueryAPI } from "../../../hooks/useAPI";
|
||||
import {
|
||||
ActionIcon,
|
||||
Button,
|
||||
@@ -12,33 +10,37 @@ import {
|
||||
Stack,
|
||||
Text,
|
||||
TextInput,
|
||||
} from "@mantine/core";
|
||||
import { FiEdit, FiPlus, FiSave, FiTrash, FiX } from "react-icons/fi";
|
||||
import { useDisclosure, useLocalStorage } from "@mantine/hooks";
|
||||
import "@mantine/core/styles/ModalBase.css";
|
||||
import "@mantine/core/styles/Modal.css";
|
||||
import { actionIconClasses, buttonClasses, modalClasses, textClasses } from "../../../styles";
|
||||
import ThemeModalContent from "./ThemeModalContent";
|
||||
import { modals } from "@mantine/modals";
|
||||
} from '@mantine/core';
|
||||
import { useDisclosure, useLocalStorage } from '@mantine/hooks';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { FiEdit, FiPlus, FiSave, FiTrash, FiX } from 'react-icons/fi';
|
||||
import { useMutationAPI, useQueryAPI } from '../../../hooks/useAPI';
|
||||
import '@mantine/core/styles/ModalBase.css';
|
||||
import '@mantine/core/styles/Modal.css';
|
||||
import { modals } from '@mantine/modals';
|
||||
import {
|
||||
actionIconClasses,
|
||||
buttonClasses,
|
||||
modalClasses,
|
||||
textClasses,
|
||||
} from '../../../styles';
|
||||
import ThemeModalContent from './ThemeModalContent';
|
||||
function ThemesSettings({ theme }: any) {
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
const [pickerOpen, { open: openPicker, close: closePicker }] =
|
||||
useDisclosure(false);
|
||||
const [colorId, setColorId] = useState<string>("");
|
||||
const [colorValue, setColorValue] = useState("#000000");
|
||||
const [pickerOpen, { open: openPicker, close: closePicker }] = useDisclosure(false);
|
||||
const [colorId, setColorId] = useState<string>('');
|
||||
const [colorValue, setColorValue] = useState('#000000');
|
||||
const [value, setValue] = useLocalStorage<any>({
|
||||
key: "theme",
|
||||
key: 'theme',
|
||||
defaultValue: {},
|
||||
});
|
||||
const { data, isFetched } = useQueryAPI({
|
||||
endpoint: "api/themes",
|
||||
endpoint: 'api/themes',
|
||||
});
|
||||
const [themesList, setThemesList] = useState([]);
|
||||
const [selectedTheme, setSelectedTheme] = useState<any>({});
|
||||
const { mutateAsync: createTheme, isPending: isCreatingTheme } =
|
||||
useMutationAPI();
|
||||
const { mutateAsync: deleteTheme, isPending: isDeletingTheme } =
|
||||
useMutationAPI();
|
||||
const { mutateAsync: createTheme, isPending: isCreatingTheme } = useMutationAPI();
|
||||
const { mutateAsync: deleteTheme, isPending: isDeletingTheme } = useMutationAPI();
|
||||
useEffect(() => {
|
||||
if (isFetched) {
|
||||
setThemesList(data);
|
||||
@@ -57,8 +59,8 @@ function ThemesSettings({ theme }: any) {
|
||||
|
||||
const handleSaveTheme = () => {
|
||||
createTheme({
|
||||
method: selectedTheme.id === undefined ? "POST" : "PATCH",
|
||||
endpoint: "api/themes",
|
||||
method: selectedTheme.id === undefined ? 'POST' : 'PATCH',
|
||||
endpoint: 'api/themes',
|
||||
body: selectedTheme,
|
||||
});
|
||||
close();
|
||||
@@ -66,11 +68,11 @@ function ThemesSettings({ theme }: any) {
|
||||
|
||||
const openDeleteConfirmModal = (theme: any) =>
|
||||
modals.openConfirmModal({
|
||||
title: "Are you sure you want to delete this theme?",
|
||||
labels: { confirm: "Delete", cancel: "Cancel" },
|
||||
confirmProps: { color: "red" },
|
||||
title: 'Are you sure you want to delete this theme?',
|
||||
labels: { confirm: 'Delete', cancel: 'Cancel' },
|
||||
confirmProps: { color: 'red' },
|
||||
onConfirm: () =>
|
||||
deleteTheme({ method: "DELETE", endpoint: "api/themes", body: theme }),
|
||||
deleteTheme({ method: 'DELETE', endpoint: 'api/themes', body: theme }),
|
||||
});
|
||||
|
||||
const handleDeleteTheme = (theme: any) => {
|
||||
@@ -81,7 +83,7 @@ function ThemesSettings({ theme }: any) {
|
||||
return (
|
||||
<>
|
||||
<Modal.Root
|
||||
size={"50%"}
|
||||
size={'50%'}
|
||||
className={modalClasses.editThemeModal}
|
||||
classNames={modalClasses}
|
||||
opened={opened}
|
||||
@@ -93,135 +95,153 @@ function ThemesSettings({ theme }: any) {
|
||||
<Modal.Title>Edit Theme</Modal.Title>
|
||||
<Modal.CloseButton />
|
||||
</Modal.Header>
|
||||
<Modal.Body p={"2rem"}>
|
||||
<Modal.Body p={'2rem'}>
|
||||
<ThemeModalContent selectedTheme={selectedTheme} />
|
||||
<Divider color="black" my="sm" />
|
||||
<Divider color='black' my='sm' />
|
||||
<TextInput
|
||||
label="Theme Name"
|
||||
label='Theme Name'
|
||||
value={selectedTheme.name}
|
||||
onChange={(e) =>
|
||||
setSelectedTheme({ ...selectedTheme, name: e.target.value })
|
||||
}
|
||||
styles={{
|
||||
label: {
|
||||
color: "black",
|
||||
color: 'black',
|
||||
},
|
||||
input: {
|
||||
color: "black",
|
||||
backgroundColor: "white",
|
||||
color: 'black',
|
||||
backgroundColor: 'white',
|
||||
},
|
||||
}}
|
||||
/>
|
||||
<Divider color="black" my="sm" />
|
||||
<Group w={"100%"} h={"100%"} gap={0}>
|
||||
<Stack w={"50%"}>
|
||||
<Group c={"black"} justify="space-between">
|
||||
<Divider color='black' my='sm' />
|
||||
<Group w={'100%'} h={'100%'} gap={0}>
|
||||
<Stack w={'50%'}>
|
||||
<Group c={'black'} justify='space-between'>
|
||||
<Text>Primary Color</Text>
|
||||
<ColorSwatch
|
||||
onClick={() => {
|
||||
setColorId("primary");
|
||||
setColorId('primary');
|
||||
openPicker();
|
||||
setColorValue(selectedTheme.colortextpri);
|
||||
}}
|
||||
radius={"sm"}
|
||||
w={"100px"}
|
||||
radius={'sm'}
|
||||
w={'100px'}
|
||||
color={selectedTheme.colortextpri}
|
||||
style={{ cursor: "pointer" }}
|
||||
style={{ cursor: 'pointer' }}
|
||||
/>
|
||||
</Group>
|
||||
<Group c={"black"} justify="space-between">
|
||||
<Group c={'black'} justify='space-between'>
|
||||
<Text>Accent Color</Text>
|
||||
<ColorSwatch
|
||||
onClick={() => {
|
||||
setColorId("accent");
|
||||
setColorId('accent');
|
||||
openPicker();
|
||||
setColorValue(selectedTheme.colortextacc);
|
||||
}}
|
||||
radius={"sm"}
|
||||
w={"100px"}
|
||||
radius={'sm'}
|
||||
w={'100px'}
|
||||
color={selectedTheme.colortextacc}
|
||||
style={{ cursor: "pointer" }}
|
||||
style={{ cursor: 'pointer' }}
|
||||
/>
|
||||
</Group>
|
||||
<Group c={"black"} justify="space-between">
|
||||
<Group c={'black'} justify='space-between'>
|
||||
<Text>Background Color</Text>
|
||||
<ColorSwatch
|
||||
onClick={() => {
|
||||
setColorId("background");
|
||||
setColorId('background');
|
||||
openPicker();
|
||||
setColorValue(selectedTheme.colorbackground);
|
||||
}}
|
||||
radius={"sm"}
|
||||
w={"100px"}
|
||||
radius={'sm'}
|
||||
w={'100px'}
|
||||
color={selectedTheme.colorbackground}
|
||||
style={{ cursor: "pointer" }}
|
||||
style={{ cursor: 'pointer' }}
|
||||
/>
|
||||
</Group>
|
||||
<Group c={"black"} justify="space-between">
|
||||
<Group c={'black'} justify='space-between'>
|
||||
<Text>Border Color</Text>
|
||||
<ColorSwatch
|
||||
onClick={() => {
|
||||
setColorId("border");
|
||||
setColorId('border');
|
||||
openPicker();
|
||||
setColorValue(selectedTheme.colorborder);
|
||||
}}
|
||||
radius={"sm"}
|
||||
w={"100px"}
|
||||
radius={'sm'}
|
||||
w={'100px'}
|
||||
color={selectedTheme.colorborder}
|
||||
style={{ cursor: "pointer" }}
|
||||
style={{ cursor: 'pointer' }}
|
||||
/>
|
||||
</Group>
|
||||
<Group c={"black"} justify="space-between">
|
||||
<Group c={'black'} justify='space-between'>
|
||||
<Text>Search Background Color</Text>
|
||||
<ColorSwatch
|
||||
onClick={() => {
|
||||
setColorId("searchbackground");
|
||||
setColorId('searchbackground');
|
||||
openPicker();
|
||||
setColorValue(selectedTheme.colorsearchbackground);
|
||||
}}
|
||||
radius={"sm"}
|
||||
w={"100px"}
|
||||
radius={'sm'}
|
||||
w={'100px'}
|
||||
color={selectedTheme.colorsearchbackground}
|
||||
style={{ cursor: "pointer" }}
|
||||
style={{ cursor: 'pointer' }}
|
||||
/>
|
||||
</Group>
|
||||
<Group c={'black'} justify='space-between'>
|
||||
<TextInput
|
||||
label='Background Image Path'
|
||||
value={selectedTheme.imagebackground}
|
||||
onChange={(e) =>
|
||||
setSelectedTheme({ ...selectedTheme, imagebackground: e.target.value })
|
||||
}
|
||||
styles={{
|
||||
label: {
|
||||
color: 'black',
|
||||
},
|
||||
input: {
|
||||
color: 'black',
|
||||
backgroundColor: 'white',
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</Group>
|
||||
</Stack>
|
||||
<Stack h={"100%"} w={"50%"} align="center" justify="center">
|
||||
<Stack h={'100%'} w={'50%'} align='center' justify='center'>
|
||||
{pickerOpen ? (
|
||||
<>
|
||||
<ColorPicker value={colorValue} onChange={setColorValue} />
|
||||
<Group w={"75%"} justify="space-between">
|
||||
<Text c={"black"}>{colorValue}</Text>
|
||||
<Group w={'75%'} justify='space-between'>
|
||||
<Text c={'black'}>{colorValue}</Text>
|
||||
<Group>
|
||||
<Button
|
||||
color={"green"}
|
||||
color={'green'}
|
||||
onClick={() => {
|
||||
switch (colorId) {
|
||||
case "primary":
|
||||
case 'primary':
|
||||
setSelectedTheme({
|
||||
...selectedTheme,
|
||||
colortextpri: colorValue,
|
||||
});
|
||||
break;
|
||||
case "accent":
|
||||
case 'accent':
|
||||
setSelectedTheme({
|
||||
...selectedTheme,
|
||||
colortextacc: colorValue,
|
||||
});
|
||||
break;
|
||||
case "background":
|
||||
case 'background':
|
||||
setSelectedTheme({
|
||||
...selectedTheme,
|
||||
colorbackground: colorValue,
|
||||
});
|
||||
break;
|
||||
case "border":
|
||||
case 'border':
|
||||
setSelectedTheme({
|
||||
...selectedTheme,
|
||||
colorborder: colorValue,
|
||||
});
|
||||
break;
|
||||
case "searchbackground":
|
||||
case 'searchbackground':
|
||||
setSelectedTheme({
|
||||
...selectedTheme,
|
||||
colorsearchbackground: colorValue,
|
||||
@@ -233,7 +253,7 @@ function ThemesSettings({ theme }: any) {
|
||||
>
|
||||
<FiSave />
|
||||
</Button>
|
||||
<Button color={"red"} onClick={closePicker}>
|
||||
<Button color={'red'} onClick={closePicker}>
|
||||
<FiX />
|
||||
</Button>
|
||||
</Group>
|
||||
@@ -241,34 +261,31 @@ function ThemesSettings({ theme }: any) {
|
||||
</>
|
||||
) : (
|
||||
<Card
|
||||
bg={"#0002"}
|
||||
h={"100%"}
|
||||
w={"90%"}
|
||||
style={{ alignItems: "center" }}
|
||||
bg={'#0002'}
|
||||
h={'100%'}
|
||||
w={'90%'}
|
||||
style={{ alignItems: 'center' }}
|
||||
>
|
||||
<Text c="black">Pick a swatch to edit the color.</Text>
|
||||
<Text c='black'>Pick a swatch to edit the color.</Text>
|
||||
</Card>
|
||||
)}
|
||||
</Stack>
|
||||
</Group>
|
||||
<Divider color="black" my="sm" />
|
||||
<Divider color='black' my='sm' />
|
||||
<Group>
|
||||
<Button color={"green"} onClick={handleSaveTheme}>
|
||||
<Button color={'green'} onClick={handleSaveTheme}>
|
||||
Save
|
||||
</Button>
|
||||
<Button color={"red"} onClick={close}>
|
||||
<Button color={'red'} onClick={close}>
|
||||
Cancel
|
||||
</Button>
|
||||
</Group>
|
||||
</Modal.Body>
|
||||
</Modal.Content>
|
||||
</Modal.Root>
|
||||
<Stack h={"100%"} w={"100%"}>
|
||||
<Stack h={'100%'} w={'100%'}>
|
||||
<Group>
|
||||
<Text
|
||||
className={textClasses.settingsSubTitle}
|
||||
classNames={textClasses}
|
||||
>
|
||||
<Text className={textClasses.settingsSubTitle} classNames={textClasses}>
|
||||
Themes
|
||||
</Text>
|
||||
<Button
|
||||
@@ -277,13 +294,13 @@ function ThemesSettings({ theme }: any) {
|
||||
onClick={() => {
|
||||
setSelectedTheme({
|
||||
id: undefined,
|
||||
name: "default",
|
||||
imagebackground: "none",
|
||||
colorbackground: "#EEEEEE",
|
||||
colorsearchbackground: "#00000033",
|
||||
colortextpri: "#222222",
|
||||
colortextacc: "#5c5c5c",
|
||||
colorborder: "#5c5c5c",
|
||||
name: 'default',
|
||||
imagebackground: 'none',
|
||||
colorbackground: '#EEEEEE',
|
||||
colorsearchbackground: '#00000033',
|
||||
colortextpri: '#222222',
|
||||
colortextacc: '#5c5c5c',
|
||||
colorborder: '#5c5c5c',
|
||||
});
|
||||
open();
|
||||
}}
|
||||
@@ -291,13 +308,13 @@ function ThemesSettings({ theme }: any) {
|
||||
<FiPlus />
|
||||
</Button>
|
||||
</Group>
|
||||
<Group justify="center">
|
||||
<Group justify='center'>
|
||||
{themesList.map((theme: any) => (
|
||||
<Stack key={theme.name} w={"300px"}>
|
||||
<Group gap={0} justify="space-between">
|
||||
<Stack key={theme.name} w={'300px'}>
|
||||
<Group gap={0} justify='space-between'>
|
||||
<Button
|
||||
w={"100%"}
|
||||
h={"75px"}
|
||||
w={'100%'}
|
||||
h={'75px'}
|
||||
style={{
|
||||
backgroundColor: theme.colorbackground,
|
||||
border: `solid ${theme.colorborder}`,
|
||||
@@ -311,8 +328,8 @@ function ThemesSettings({ theme }: any) {
|
||||
{theme.name}
|
||||
</Button>
|
||||
</Group>
|
||||
<Group justify="space-between" gap={0}>
|
||||
<Group className="theme-palette">
|
||||
<Group justify='space-between' gap={0}>
|
||||
<Group className='theme-palette'>
|
||||
<ActionIcon
|
||||
className={actionIconClasses.editButton}
|
||||
classNames={actionIconClasses}
|
||||
@@ -331,7 +348,7 @@ function ThemesSettings({ theme }: any) {
|
||||
classNames={actionIconClasses}
|
||||
onClick={() => handleDeleteTheme(theme)}
|
||||
>
|
||||
<FiTrash color="red" />
|
||||
<FiTrash color='red' />
|
||||
</ActionIcon>
|
||||
</Group>
|
||||
</Group>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import actionIconClasses from "./ActionIcon.module.css";
|
||||
import buttonClasses from "./Button.module.css";
|
||||
import menuClasses from "./Menu.module.css";
|
||||
import modalClasses from "./Modal.module.css";
|
||||
import navLinkClasses from "./NavLink.module.css";
|
||||
import popoverClasses from "./Popover.module.css";
|
||||
import selectClasses from "./Select.module.css";
|
||||
import stackClasses from "./Stack.module.css";
|
||||
import tabClasses from "./Tabs.module.css";
|
||||
import textClasses from "./Text.module.css";
|
||||
import textInputClasses from "./TextInput.module.css";
|
||||
import actionIconClasses from './ActionIcon.module.css';
|
||||
import buttonClasses from './Button.module.css';
|
||||
import menuClasses from './Menu.module.css';
|
||||
import modalClasses from './Modal.module.css';
|
||||
import navLinkClasses from './NavLink.module.css';
|
||||
import popoverClasses from './Popover.module.css';
|
||||
import selectClasses from './Select.module.css';
|
||||
import stackClasses from './Stack.module.css';
|
||||
import tabClasses from './Tabs.module.css';
|
||||
import textClasses from './Text.module.css';
|
||||
import textInputClasses from './TextInput.module.css';
|
||||
|
||||
export {
|
||||
actionIconClasses,
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { defineConfig } from "vite";
|
||||
import react from '@vitejs/plugin-react';
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
server: {
|
||||
port: 3000,
|
||||
host: "0.0.0.0",
|
||||
host: '0.0.0.0',
|
||||
proxy: {
|
||||
"/api": {
|
||||
target: "http://localhost:5000/trigger",
|
||||
'/api': {
|
||||
target: 'http://localhost:5000/trigger',
|
||||
changeOrigin: false,
|
||||
secure: false,
|
||||
},
|
||||
@@ -17,10 +17,10 @@ export default defineConfig({
|
||||
},
|
||||
preview: {
|
||||
port: 3000,
|
||||
host: "0.0.0.0",
|
||||
host: '0.0.0.0',
|
||||
proxy: {
|
||||
api: {
|
||||
target: "http://localhost:5000",
|
||||
target: 'http://localhost:5000',
|
||||
changeOrigin: false,
|
||||
secure: false,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user