Compare commits
26 Commits
a4cdb4b1cc
...
develop/io
Author | SHA1 | Date | |
---|---|---|---|
![]() |
30e4c69343 | ||
![]() |
04634b5c65 | ||
![]() |
f659020d89 | ||
![]() |
184aaa1b0a | ||
![]() |
a6170778cd | ||
![]() |
650127821b | ||
![]() |
5440f8ea14 | ||
![]() |
f4c9dbcc34 | ||
![]() |
f756fb8527 | ||
![]() |
3f10a0728c | ||
![]() |
ee0aa0353b | ||
![]() |
2c7316786c | ||
![]() |
89f91ec2a0 | ||
![]() |
1441863dcd | ||
![]() |
1835caee68 | ||
![]() |
bac8c70d4b | ||
![]() |
975a528b49 | ||
![]() |
749fef7e28 | ||
![]() |
cf34833d42 | ||
![]() |
7bb45316af | ||
![]() |
02771185af | ||
![]() |
cf70e2af21 | ||
![]() |
1a77c3a5e8 | ||
![]() |
af446aed59 | ||
![]() |
c7f1f544ec | ||
![]() |
99ee2f9fc3 |
10
.prettierrc
Normal file
10
.prettierrc
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"endOfLine": "lf",
|
||||||
|
"printWidth": 120,
|
||||||
|
"quoteProps": "consistent",
|
||||||
|
"semi": true,
|
||||||
|
"singleQuote": true,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"trailingComma": "es5",
|
||||||
|
"plugins": []
|
||||||
|
}
|
@@ -1,11 +1,14 @@
|
|||||||
|
```markdown
|
||||||
# Greetings
|
# Greetings
|
||||||
|
|
||||||
Hi,
|
Hi,
|
||||||
Imaging you are a software engineer and i will send you the guideline.
|
|
||||||
|
Imagine you are a software engineer and i will send you the guideline.
|
||||||
plesae read it, prepare yourself and i will tell you the task afterwards
|
plesae read it, prepare yourself and i will tell you the task afterwards
|
||||||
|
|
||||||
please read and understand the markdown files in directory
|
please read and understand the markdown files in directory
|
||||||
`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/000_AI_WORKSPACE/software_engineer/greetings`,
|
`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/000_AI_WORKSPACE/software-engineer/greetings`,
|
||||||
it provides background information of project i want you to help.
|
it provides background information of project i want you to help.
|
||||||
|
|
||||||
thanks
|
thanks
|
||||||
|
```
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Generated at: 2025-05-11T08:58:29.867Z
|
// Generated at: 2025-05-12T06:02:53.613Z
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -114,7 +114,6 @@ Table Notifications {
|
|||||||
id text [pk, not null]
|
id text [pk, not null]
|
||||||
read boolean
|
read boolean
|
||||||
type text
|
type text
|
||||||
author text
|
|
||||||
job text
|
job text
|
||||||
description text
|
description text
|
||||||
NOTI_ID text
|
NOTI_ID text
|
||||||
@@ -122,6 +121,10 @@ Table Notifications {
|
|||||||
updated datetime
|
updated datetime
|
||||||
to_user_id integer [ref: > UserMetas.id] // relation704048736
|
to_user_id integer [ref: > UserMetas.id] // relation704048736
|
||||||
from_user_id integer [ref: > UserMetas.id] // relation556806202
|
from_user_id integer [ref: > UserMetas.id] // relation556806202
|
||||||
|
author integer [ref: > UserMetas.id] // relation3182418120
|
||||||
|
content text
|
||||||
|
company text
|
||||||
|
link varchar
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@@ -1057,16 +1057,6 @@
|
|||||||
"system": false,
|
"system": false,
|
||||||
"type": "text"
|
"type": "text"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"hidden": false,
|
|
||||||
"id": "json3182418120",
|
|
||||||
"maxSize": 0,
|
|
||||||
"name": "author",
|
|
||||||
"presentable": false,
|
|
||||||
"required": false,
|
|
||||||
"system": false,
|
|
||||||
"type": "json"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"hidden": false,
|
"hidden": false,
|
||||||
"id": "json4225294584",
|
"id": "json4225294584",
|
||||||
@@ -1150,6 +1140,51 @@
|
|||||||
"required": false,
|
"required": false,
|
||||||
"system": false,
|
"system": false,
|
||||||
"type": "relation"
|
"type": "relation"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cascadeDelete": false,
|
||||||
|
"collectionId": "pbc_1305841361",
|
||||||
|
"hidden": false,
|
||||||
|
"id": "relation3182418120",
|
||||||
|
"maxSelect": 1,
|
||||||
|
"minSelect": 0,
|
||||||
|
"name": "author",
|
||||||
|
"presentable": false,
|
||||||
|
"required": false,
|
||||||
|
"system": false,
|
||||||
|
"type": "relation"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"convertURLs": false,
|
||||||
|
"hidden": false,
|
||||||
|
"id": "editor4274335913",
|
||||||
|
"maxSize": 0,
|
||||||
|
"name": "content",
|
||||||
|
"presentable": false,
|
||||||
|
"required": false,
|
||||||
|
"system": false,
|
||||||
|
"type": "editor"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hidden": false,
|
||||||
|
"id": "json1337919823",
|
||||||
|
"maxSize": 0,
|
||||||
|
"name": "company",
|
||||||
|
"presentable": false,
|
||||||
|
"required": false,
|
||||||
|
"system": false,
|
||||||
|
"type": "json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"exceptDomains": null,
|
||||||
|
"hidden": false,
|
||||||
|
"id": "url917281265",
|
||||||
|
"name": "link",
|
||||||
|
"onlyDomains": null,
|
||||||
|
"presentable": false,
|
||||||
|
"required": false,
|
||||||
|
"system": false,
|
||||||
|
"type": "url"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"indexes": [],
|
"indexes": [],
|
||||||
|
@@ -6,6 +6,9 @@ import ListItemIcon from '@mui/material/ListItemIcon';
|
|||||||
import { Box } from '@mui/system';
|
import { Box } from '@mui/system';
|
||||||
import { Trash as TrashIcon } from '@phosphor-icons/react/dist/ssr/Trash';
|
import { Trash as TrashIcon } from '@phosphor-icons/react/dist/ssr/Trash';
|
||||||
|
|
||||||
|
import { logger } from '@/lib/default-logger';
|
||||||
|
import { toast } from '@/components/core/toaster';
|
||||||
|
|
||||||
interface PropsHelloworld {
|
interface PropsHelloworld {
|
||||||
message: string;
|
message: string;
|
||||||
}
|
}
|
||||||
@@ -33,11 +36,21 @@ function InnerComponent(): React.JSX.Element {
|
|||||||
// RULES: sample of main component
|
// RULES: sample of main component
|
||||||
function MainComponent(): React.JSX.Element {
|
function MainComponent(): React.JSX.Element {
|
||||||
const [state, setState] = React.useState<string>('');
|
const [state, setState] = React.useState<string>('');
|
||||||
|
const [loading, setLoading] = React.useState(true);
|
||||||
|
const [showError, setShowError] = React.useState<boolean>(false);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
setState(funcHelloworld('hello'));
|
try {
|
||||||
|
setState(funcHelloworld('hello'));
|
||||||
|
} catch (error) {
|
||||||
|
setShowError(true);
|
||||||
|
}
|
||||||
|
setLoading(false);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
if (loading) return <>Loading</>;
|
||||||
|
if (showError) return <>Error</>;
|
||||||
|
|
||||||
// you should obey react/jsx-no-useless-fragment
|
// you should obey react/jsx-no-useless-fragment
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
|
@@ -189,7 +189,15 @@ function NotificationsButton(): React.JSX.Element {
|
|||||||
<Tooltip title="Notifications">
|
<Tooltip title="Notifications">
|
||||||
<Badge
|
<Badge
|
||||||
color="error"
|
color="error"
|
||||||
sx={{ '& .MuiBadge-dot': { borderRadius: '50%', height: '10px', right: '6px', top: '6px', width: '10px' } }}
|
sx={{
|
||||||
|
'& .MuiBadge-dot': {
|
||||||
|
borderRadius: '50%',
|
||||||
|
right: '6px',
|
||||||
|
top: '6px',
|
||||||
|
height: '10px',
|
||||||
|
width: '10px',
|
||||||
|
},
|
||||||
|
}}
|
||||||
variant="dot"
|
variant="dot"
|
||||||
>
|
>
|
||||||
<IconButton
|
<IconButton
|
||||||
|
@@ -1,38 +1,42 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import Avatar from '@mui/material/Avatar';
|
import { getNotificationsByUserId } from '@/db/Notifications/GetNotificationByUserId';
|
||||||
|
import type { Notification } from '@/db/Notifications/type';
|
||||||
import Box from '@mui/material/Box';
|
import Box from '@mui/material/Box';
|
||||||
import IconButton from '@mui/material/IconButton';
|
import IconButton from '@mui/material/IconButton';
|
||||||
import Link from '@mui/material/Link';
|
|
||||||
import List from '@mui/material/List';
|
import List from '@mui/material/List';
|
||||||
import ListItem from '@mui/material/ListItem';
|
|
||||||
import Popover from '@mui/material/Popover';
|
import Popover from '@mui/material/Popover';
|
||||||
import Stack from '@mui/material/Stack';
|
import Stack from '@mui/material/Stack';
|
||||||
import Tooltip from '@mui/material/Tooltip';
|
import Tooltip from '@mui/material/Tooltip';
|
||||||
import Typography from '@mui/material/Typography';
|
import Typography from '@mui/material/Typography';
|
||||||
import { ChatText as ChatTextIcon } from '@phosphor-icons/react/dist/ssr/ChatText';
|
|
||||||
import { EnvelopeSimple as EnvelopeSimpleIcon } from '@phosphor-icons/react/dist/ssr/EnvelopeSimple';
|
import { EnvelopeSimple as EnvelopeSimpleIcon } from '@phosphor-icons/react/dist/ssr/EnvelopeSimple';
|
||||||
import { User as UserIcon } from '@phosphor-icons/react/dist/ssr/User';
|
|
||||||
import { X as XIcon } from '@phosphor-icons/react/dist/ssr/X';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { dayjs } from '@/lib/dayjs';
|
import { User } from '@/types/user';
|
||||||
|
import { useHelloworld } from '@/hooks/use-helloworld';
|
||||||
|
import { useUser } from '@/hooks/use-user';
|
||||||
|
|
||||||
|
import { NotificationItem } from './notification-item';
|
||||||
// import type { Notification } from './type.d.tsx.del';
|
// import type { Notification } from './type.d.tsx.del';
|
||||||
import { SampleNotifications } from './sample-notifications';
|
import { SampleNotifications } from './sample-notifications';
|
||||||
import { useHelloworld } from '@/hooks/use-helloworld';
|
import getImageUrlFromFile from '@/lib/get-image-url-from-file.ts';
|
||||||
import { getAllNotifications } from '@/db/Notifications/GetAll';
|
import { getUnreadNotificationsByUserId } from '@/db/Notifications/GetUnreadNotificationsByUserId';
|
||||||
import { ListResult, RecordModel } from 'pocketbase';
|
import { logger } from '@/lib/default-logger';
|
||||||
import { defaultNotification } from '@/db/Notifications/constants';
|
import { toast } from '@/components/core/toaster';
|
||||||
import { getNotificationsByUserId } from '@/db/Notifications/GetNotificationByUserId';
|
|
||||||
import { Notification } from '@/db/Notifications/type';
|
import { NoteBlank as NoteBlankIcon } from '@phosphor-icons/react/dist/ssr/NoteBlank';
|
||||||
|
import { Sun as SunIcon } from '@phosphor-icons/react/dist/ssr/Sun';
|
||||||
|
import { MarkAllAsReadButton } from './mark-all-as-read-button';
|
||||||
|
import { Button } from '@mui/material';
|
||||||
|
|
||||||
export interface NotificationsPopoverProps {
|
export interface NotificationsPopoverProps {
|
||||||
anchorEl: null | Element;
|
anchorEl: null | Element;
|
||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
onMarkAllAsRead?: () => void;
|
onMarkAllAsRead?: () => void;
|
||||||
onRemoveOne?: (id: string) => void;
|
onRemoveOne?: (id: string, reload: () => Promise<void>) => void;
|
||||||
open?: boolean;
|
open?: boolean;
|
||||||
|
setListLength: React.Dispatch<React.SetStateAction<number>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function NotificationsPopover({
|
export function NotificationsPopover({
|
||||||
@@ -41,37 +45,101 @@ export function NotificationsPopover({
|
|||||||
onMarkAllAsRead,
|
onMarkAllAsRead,
|
||||||
onRemoveOne,
|
onRemoveOne,
|
||||||
open = false,
|
open = false,
|
||||||
|
setListLength,
|
||||||
}: NotificationsPopoverProps): React.JSX.Element {
|
}: NotificationsPopoverProps): React.JSX.Element {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [notiList, setNotiList] = React.useState<Notification[]>([]);
|
const [notiList, setNotiList] = React.useState<Notification[]>([]);
|
||||||
|
const { user } = useUser();
|
||||||
|
|
||||||
const [loading, setLoading] = React.useState(false);
|
const [loading, setLoading] = React.useState(true);
|
||||||
const [error, setError] = React.useState<string | null>(null);
|
const [showError, setShowError] = React.useState<boolean>(false);
|
||||||
|
|
||||||
const { data, handleClose, handleOpen, open: testOpen } = useHelloworld<string>();
|
async function loadUnreadNotifications(): Promise<void> {
|
||||||
React.useEffect(() => {
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
async function LoadAllNotifications() {
|
try {
|
||||||
const notiList: Notification[] = await getNotificationsByUserId('1');
|
if (user?.id) {
|
||||||
setNotiList(notiList);
|
const tempNotiList: Notification[] = await getUnreadNotificationsByUserId(user.id);
|
||||||
|
setNotiList(tempNotiList);
|
||||||
|
setListLength(tempNotiList.length);
|
||||||
|
}
|
||||||
|
} catch (loadNotiError) {
|
||||||
|
logger.error(loadNotiError);
|
||||||
|
toast.error('error during loading noti list');
|
||||||
}
|
}
|
||||||
setLoading(false);
|
|
||||||
void LoadAllNotifications();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
if (loading) return <>Loading</>;
|
setLoading(false);
|
||||||
if (error) return <>Error</>;
|
}
|
||||||
if (notiList.length == 0)
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (user?.id) {
|
||||||
|
void loadUnreadNotifications();
|
||||||
|
}
|
||||||
|
}, [user]);
|
||||||
|
|
||||||
|
// if (loading) return <>Loading</>;
|
||||||
|
// if (showError) return <>Error</>;
|
||||||
|
|
||||||
|
if (notiList.length === 0)
|
||||||
return (
|
return (
|
||||||
<Popover
|
<Popover
|
||||||
anchorEl={anchorEl}
|
anchorEl={anchorEl}
|
||||||
anchorOrigin={{ horizontal: 'right', vertical: 'bottom' }}
|
anchorOrigin={{ horizontal: 'right', vertical: 'bottom' }}
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
open={open}
|
open={open}
|
||||||
slotProps={{ paper: { sx: { width: '380px' } } }}
|
slotProps={{ paper: { sx: { width: 'unset' } } }}
|
||||||
transformOrigin={{ horizontal: 'right', vertical: 'top' }}
|
transformOrigin={{ horizontal: 'right', vertical: 'top' }}
|
||||||
>
|
>
|
||||||
list is empty
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
spacing={2}
|
||||||
|
sx={{ alignItems: 'center', justifyContent: 'space-between', px: 3, py: 2 }}
|
||||||
|
>
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
spacing={2}
|
||||||
|
sx={{ alignItems: 'left' }}
|
||||||
|
>
|
||||||
|
<Typography variant="h6">
|
||||||
|
{t('Notifications')} ({notiList.length})
|
||||||
|
</Typography>
|
||||||
|
|
||||||
|
{loading ? (
|
||||||
|
<Typography
|
||||||
|
color="gray"
|
||||||
|
variant="subtitle2"
|
||||||
|
>
|
||||||
|
({t('loading')})
|
||||||
|
</Typography>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
{/* MarkAllAsReadButton(onMarkAllAsRead, notiList.length <= 0) */}
|
||||||
|
<MarkAllAsReadButton
|
||||||
|
onMarkAllAsRead={onMarkAllAsRead}
|
||||||
|
disabled={notiList.length <= 0}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
|
<Stack
|
||||||
|
direction="column"
|
||||||
|
spacing={2}
|
||||||
|
sx={{ alignItems: 'center', padding: '50px' }}
|
||||||
|
>
|
||||||
|
<SunIcon
|
||||||
|
size={48}
|
||||||
|
color="lightgray"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Typography
|
||||||
|
color="lightgray"
|
||||||
|
variant={'subtitle2'}
|
||||||
|
>
|
||||||
|
{t('list-is-empty')}
|
||||||
|
</Typography>
|
||||||
|
|
||||||
|
<Button variant="outlined">{t('refresh')}</Button>
|
||||||
|
</Stack>
|
||||||
</Popover>
|
</Popover>
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -80,6 +148,7 @@ export function NotificationsPopover({
|
|||||||
anchorEl={anchorEl}
|
anchorEl={anchorEl}
|
||||||
anchorOrigin={{ horizontal: 'right', vertical: 'bottom' }}
|
anchorOrigin={{ horizontal: 'right', vertical: 'bottom' }}
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
|
// todo: should not use 'true', fallback to 'open'
|
||||||
open={open}
|
open={open}
|
||||||
slotProps={{ paper: { sx: { width: '380px' } } }}
|
slotProps={{ paper: { sx: { width: '380px' } } }}
|
||||||
transformOrigin={{ horizontal: 'right', vertical: 'top' }}
|
transformOrigin={{ horizontal: 'right', vertical: 'top' }}
|
||||||
@@ -89,16 +158,32 @@ export function NotificationsPopover({
|
|||||||
spacing={2}
|
spacing={2}
|
||||||
sx={{ alignItems: 'center', justifyContent: 'space-between', px: 3, py: 2 }}
|
sx={{ alignItems: 'center', justifyContent: 'space-between', px: 3, py: 2 }}
|
||||||
>
|
>
|
||||||
<Typography variant="h6">{t('Notifications')}</Typography>
|
<Stack
|
||||||
<Tooltip title={t('Mark all as read')}>
|
direction="row"
|
||||||
<IconButton
|
spacing={2}
|
||||||
edge="end"
|
sx={{ alignItems: 'left' }}
|
||||||
onClick={onMarkAllAsRead}
|
>
|
||||||
>
|
<Typography variant="h6">
|
||||||
<EnvelopeSimpleIcon />
|
{t('Notifications')} ({notiList.length})
|
||||||
</IconButton>
|
</Typography>
|
||||||
</Tooltip>
|
|
||||||
|
{loading ? (
|
||||||
|
<Typography
|
||||||
|
color="gray"
|
||||||
|
variant="subtitle2"
|
||||||
|
>
|
||||||
|
({t('loading')})
|
||||||
|
</Typography>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
<MarkAllAsReadButton
|
||||||
|
onMarkAllAsRead={onMarkAllAsRead}
|
||||||
|
disabled={notiList.length <= 0}
|
||||||
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
{notiList.length === 0 ? (
|
{notiList.length === 0 ? (
|
||||||
<Box sx={{ p: 2 }}>
|
<Box sx={{ p: 2 }}>
|
||||||
<Typography variant="subtitle2">{t('There are no notifications')}</Typography>
|
<Typography variant="subtitle2">{t('There are no notifications')}</Typography>
|
||||||
@@ -108,11 +193,11 @@ export function NotificationsPopover({
|
|||||||
<List disablePadding>
|
<List disablePadding>
|
||||||
{notiList.map((notification, index) => (
|
{notiList.map((notification, index) => (
|
||||||
<NotificationItem
|
<NotificationItem
|
||||||
divider={index < SampleNotifications.length - 1}
|
divider={index < notiList.length - 1}
|
||||||
key={notification.id}
|
key={notification.id}
|
||||||
notification={notification}
|
notification={notification}
|
||||||
onRemove={() => {
|
onRemove={() => {
|
||||||
onRemoveOne?.(notification.id);
|
onRemoveOne?.(notification.id, () => loadUnreadNotifications());
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
@@ -123,135 +208,25 @@ export function NotificationsPopover({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface NotificationItemProps {
|
// TODO: remove me
|
||||||
divider?: boolean;
|
// function MarkAllAsReadButton({
|
||||||
notification: Notification;
|
// onMarkAllAsRead,
|
||||||
onRemove?: () => void;
|
// disabled,
|
||||||
}
|
// }: {
|
||||||
|
// onMarkAllAsRead: (() => void) | undefined;
|
||||||
|
// disabled: boolean;
|
||||||
|
// }): React.JSX.Element {
|
||||||
|
// const { t } = useTranslation();
|
||||||
|
|
||||||
function NotificationItem({ divider, notification, onRemove }: NotificationItemProps): React.JSX.Element {
|
// return (
|
||||||
return (
|
// <Tooltip title={t('mark-all-as-read')}>
|
||||||
<ListItem
|
// <IconButton
|
||||||
divider={divider}
|
// edge="end"
|
||||||
sx={{ alignItems: 'flex-start', justifyContent: 'space-between' }}
|
// onClick={onMarkAllAsRead}
|
||||||
>
|
// disabled={disabled}
|
||||||
<NotificationContent notification={notification} />
|
// >
|
||||||
<Tooltip title="Remove">
|
// <EnvelopeSimpleIcon color={disabled ? 'lightgray' : 'black'} />
|
||||||
<IconButton
|
// </IconButton>
|
||||||
edge="end"
|
// </Tooltip>
|
||||||
onClick={onRemove}
|
// );
|
||||||
size="small"
|
// }
|
||||||
>
|
|
||||||
<XIcon />
|
|
||||||
</IconButton>
|
|
||||||
</Tooltip>
|
|
||||||
</ListItem>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
interface NotificationContentProps {
|
|
||||||
notification: Notification;
|
|
||||||
}
|
|
||||||
|
|
||||||
function NotificationContent({ notification }: NotificationContentProps): React.JSX.Element {
|
|
||||||
if (notification.type === 'new_feature') {
|
|
||||||
return (
|
|
||||||
<Stack
|
|
||||||
direction="row"
|
|
||||||
spacing={2}
|
|
||||||
sx={{ alignItems: 'flex-start' }}
|
|
||||||
>
|
|
||||||
<Avatar>
|
|
||||||
<ChatTextIcon fontSize="var(--Icon-fontSize)" />
|
|
||||||
</Avatar>
|
|
||||||
<div>
|
|
||||||
<Typography variant="subtitle2">New feature!</Typography>
|
|
||||||
<Typography variant="body2">{notification.description}</Typography>
|
|
||||||
<Typography
|
|
||||||
color="text.secondary"
|
|
||||||
variant="caption"
|
|
||||||
>
|
|
||||||
{dayjs(notification.createdAt).format('MMM D, hh:mm A')}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
</Stack>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (notification.type === 'new_company') {
|
|
||||||
return (
|
|
||||||
<Stack
|
|
||||||
direction="row"
|
|
||||||
spacing={2}
|
|
||||||
sx={{ alignItems: 'flex-start' }}
|
|
||||||
>
|
|
||||||
<Avatar src={notification.author.avatar}>
|
|
||||||
<UserIcon />
|
|
||||||
</Avatar>
|
|
||||||
<div>
|
|
||||||
<Typography variant="body2">
|
|
||||||
<Typography
|
|
||||||
component="span"
|
|
||||||
variant="subtitle2"
|
|
||||||
>
|
|
||||||
{notification.author.name}
|
|
||||||
</Typography>{' '}
|
|
||||||
created{' '}
|
|
||||||
<Link
|
|
||||||
underline="always"
|
|
||||||
variant="body2"
|
|
||||||
>
|
|
||||||
{notification.company.name}
|
|
||||||
</Link>{' '}
|
|
||||||
company
|
|
||||||
</Typography>
|
|
||||||
<Typography
|
|
||||||
color="text.secondary"
|
|
||||||
variant="caption"
|
|
||||||
>
|
|
||||||
{dayjs(notification.createdAt).format('MMM D, hh:mm A')}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
</Stack>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (notification.type === 'new_job') {
|
|
||||||
return (
|
|
||||||
<Stack
|
|
||||||
direction="row"
|
|
||||||
spacing={2}
|
|
||||||
sx={{ alignItems: 'flex-start' }}
|
|
||||||
>
|
|
||||||
<Avatar src={notification.author.avatar}>
|
|
||||||
<UserIcon />
|
|
||||||
</Avatar>
|
|
||||||
<div>
|
|
||||||
<Typography variant="body2">
|
|
||||||
<Typography
|
|
||||||
component="span"
|
|
||||||
variant="subtitle2"
|
|
||||||
>
|
|
||||||
{notification.author.name}
|
|
||||||
</Typography>{' '}
|
|
||||||
added a new job{' '}
|
|
||||||
<Link
|
|
||||||
underline="always"
|
|
||||||
variant="body2"
|
|
||||||
>
|
|
||||||
{notification.job.title}
|
|
||||||
</Link>
|
|
||||||
</Typography>
|
|
||||||
<Typography
|
|
||||||
color="text.secondary"
|
|
||||||
variant="caption"
|
|
||||||
>
|
|
||||||
{dayjs(notification.createdAt).format('MMM D, hh:mm A')}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
</Stack>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return <div />;
|
|
||||||
}
|
|
||||||
|
@@ -0,0 +1,29 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import * as React from 'react';
|
||||||
|
import IconButton from '@mui/material/IconButton';
|
||||||
|
import Tooltip from '@mui/material/Tooltip';
|
||||||
|
import { EnvelopeSimple as EnvelopeSimpleIcon } from '@phosphor-icons/react/dist/ssr/EnvelopeSimple';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
|
export function MarkAllAsReadButton({
|
||||||
|
onMarkAllAsRead,
|
||||||
|
disabled,
|
||||||
|
}: {
|
||||||
|
onMarkAllAsRead: (() => void) | undefined;
|
||||||
|
disabled: boolean;
|
||||||
|
}): React.JSX.Element {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Tooltip title={t('mark-all-as-read')}>
|
||||||
|
<IconButton
|
||||||
|
edge="end"
|
||||||
|
onClick={onMarkAllAsRead}
|
||||||
|
disabled={disabled}
|
||||||
|
>
|
||||||
|
<EnvelopeSimpleIcon color={disabled ? 'lightgray' : 'black'} />
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
}
|
@@ -0,0 +1,139 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import * as React from 'react';
|
||||||
|
import type { Notification } from '@/db/Notifications/type';
|
||||||
|
import Avatar from '@mui/material/Avatar';
|
||||||
|
import Link from '@mui/material/Link';
|
||||||
|
import Stack from '@mui/material/Stack';
|
||||||
|
import Typography from '@mui/material/Typography';
|
||||||
|
import { ChatText as ChatTextIcon } from '@phosphor-icons/react/dist/ssr/ChatText';
|
||||||
|
import { User as UserIcon } from '@phosphor-icons/react/dist/ssr/User';
|
||||||
|
|
||||||
|
import { dayjs } from '@/lib/dayjs';
|
||||||
|
import getImageUrlFromFile from '@/lib/get-image-url-from-file.ts';
|
||||||
|
import { useRouter } from 'next/navigation';
|
||||||
|
import { toast } from '@/components/core/toaster';
|
||||||
|
|
||||||
|
interface NotificationContentProps {
|
||||||
|
notification: Notification;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function NotificationContent({ notification }: NotificationContentProps): React.JSX.Element {
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
if (notification.type === 'new_feature') {
|
||||||
|
return (
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
spacing={2}
|
||||||
|
sx={{ alignItems: 'flex-start' }}
|
||||||
|
>
|
||||||
|
<Avatar>
|
||||||
|
<ChatTextIcon fontSize="var(--Icon-fontSize)" />
|
||||||
|
</Avatar>
|
||||||
|
<div>
|
||||||
|
<Typography variant="subtitle2">New feature!</Typography>
|
||||||
|
<Typography variant="body2">{notification.description}</Typography>
|
||||||
|
<Typography
|
||||||
|
color="text.secondary"
|
||||||
|
variant="caption"
|
||||||
|
>
|
||||||
|
{dayjs(notification.createdAt).format('MMM D, hh:mm A')}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (notification.type === 'new_company') {
|
||||||
|
return (
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
spacing={2}
|
||||||
|
sx={{ alignItems: 'flex-start' }}
|
||||||
|
>
|
||||||
|
<Avatar src={notification?.author?.avatar || ''}>
|
||||||
|
<UserIcon size={24} />
|
||||||
|
</Avatar>
|
||||||
|
<div>
|
||||||
|
<Typography variant="body2">
|
||||||
|
<Typography
|
||||||
|
component="span"
|
||||||
|
variant="subtitle2"
|
||||||
|
>
|
||||||
|
{notification?.author?.name}
|
||||||
|
</Typography>{' '}
|
||||||
|
created{' '}
|
||||||
|
<Link
|
||||||
|
underline="always"
|
||||||
|
variant="body2"
|
||||||
|
>
|
||||||
|
{notification?.company?.name}
|
||||||
|
</Link>{' '}
|
||||||
|
company
|
||||||
|
</Typography>
|
||||||
|
<Typography
|
||||||
|
color="text.secondary"
|
||||||
|
variant="caption"
|
||||||
|
>
|
||||||
|
{dayjs(notification.created).format('MMM D, hh:mm A')}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (notification.type === 'new_job') {
|
||||||
|
const handleClick = (): void => {
|
||||||
|
try {
|
||||||
|
if (notification.link) {
|
||||||
|
router.push(notification.link);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
toast.error((error as { message: string }).message);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
spacing={2}
|
||||||
|
sx={{
|
||||||
|
alignItems: 'flex-start',
|
||||||
|
cursor: notification.link ? 'pointer' : '',
|
||||||
|
}}
|
||||||
|
//
|
||||||
|
onClick={handleClick}
|
||||||
|
>
|
||||||
|
<Avatar src={notification?.author?.avatar}>
|
||||||
|
<UserIcon />
|
||||||
|
</Avatar>
|
||||||
|
<div>
|
||||||
|
<Typography variant="body2">
|
||||||
|
<Typography
|
||||||
|
component="span"
|
||||||
|
variant="subtitle2"
|
||||||
|
>
|
||||||
|
{notification?.author?.name}
|
||||||
|
</Typography>{' '}
|
||||||
|
added a new job{' '}
|
||||||
|
<Link
|
||||||
|
underline="always"
|
||||||
|
variant="body2"
|
||||||
|
>
|
||||||
|
{notification?.job?.title}
|
||||||
|
</Link>
|
||||||
|
</Typography>
|
||||||
|
<Typography
|
||||||
|
color="text.secondary"
|
||||||
|
variant="caption"
|
||||||
|
>
|
||||||
|
{dayjs(notification.created).format('MMM D, hh:mm A')}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return <div />;
|
||||||
|
}
|
@@ -0,0 +1,36 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import * as React from 'react';
|
||||||
|
import type { Notification } from '@/db/Notifications/type';
|
||||||
|
import IconButton from '@mui/material/IconButton';
|
||||||
|
import ListItem from '@mui/material/ListItem';
|
||||||
|
import Tooltip from '@mui/material/Tooltip';
|
||||||
|
import { X as XIcon } from '@phosphor-icons/react/dist/ssr/X';
|
||||||
|
|
||||||
|
import { NotificationContent } from './notification-content';
|
||||||
|
|
||||||
|
interface NotificationItemProps {
|
||||||
|
divider?: boolean;
|
||||||
|
notification: Notification;
|
||||||
|
onRemove?: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function NotificationItem({ divider, notification, onRemove }: NotificationItemProps): React.JSX.Element {
|
||||||
|
return (
|
||||||
|
<ListItem
|
||||||
|
divider={divider}
|
||||||
|
sx={{ alignItems: 'flex-start', justifyContent: 'space-between' }}
|
||||||
|
>
|
||||||
|
<NotificationContent notification={notification} />
|
||||||
|
<Tooltip title="Remove">
|
||||||
|
<IconButton
|
||||||
|
edge="end"
|
||||||
|
onClick={onRemove}
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
<XIcon />
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
</ListItem>
|
||||||
|
);
|
||||||
|
}
|
@@ -1,6 +1,7 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
import { Notification } from '@/db/Notifications/type';
|
||||||
import { dayjs } from '@/lib/dayjs';
|
import { dayjs } from '@/lib/dayjs';
|
||||||
import type { Notification } from './type.d.tsx.del';
|
// import type { Notification } from './type.d.tsx';
|
||||||
|
|
||||||
export const SampleNotifications = [
|
export const SampleNotifications = [
|
||||||
{
|
{
|
||||||
@@ -8,7 +9,7 @@ export const SampleNotifications = [
|
|||||||
createdAt: dayjs().subtract(7, 'minute').subtract(5, 'hour').subtract(1, 'day').toDate(),
|
createdAt: dayjs().subtract(7, 'minute').subtract(5, 'hour').subtract(1, 'day').toDate(),
|
||||||
read: false,
|
read: false,
|
||||||
type: 'new_job',
|
type: 'new_job',
|
||||||
author: { name: 'Jie Yan', avatar: '/assets/avatar-8.png' },
|
author: { id: '0001', collectionId: '0001', name: 'Jie Yan', avatar: '/assets/avatar-8.png' },
|
||||||
job: { title: 'Remote React / React Native Developer' },
|
job: { title: 'Remote React / React Native Developer' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -16,7 +17,7 @@ export const SampleNotifications = [
|
|||||||
createdAt: dayjs().subtract(18, 'minute').subtract(3, 'hour').subtract(5, 'day').toDate(),
|
createdAt: dayjs().subtract(18, 'minute').subtract(3, 'hour').subtract(5, 'day').toDate(),
|
||||||
read: true,
|
read: true,
|
||||||
type: 'new_job',
|
type: 'new_job',
|
||||||
author: { name: 'Fran Perez', avatar: '/assets/avatar-5.png' },
|
author: { id: '0001', collectionId: '0001', name: 'Fran Perez', avatar: '/assets/avatar-5.png' },
|
||||||
job: { title: 'Senior Golang Backend Engineer' },
|
job: { title: 'Senior Golang Backend Engineer' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -24,6 +25,7 @@ export const SampleNotifications = [
|
|||||||
createdAt: dayjs().subtract(4, 'minute').subtract(5, 'hour').subtract(7, 'day').toDate(),
|
createdAt: dayjs().subtract(4, 'minute').subtract(5, 'hour').subtract(7, 'day').toDate(),
|
||||||
read: true,
|
read: true,
|
||||||
type: 'new_feature',
|
type: 'new_feature',
|
||||||
|
author: { id: '0001', collectionId: '0001', name: 'Fran Perez', avatar: '/assets/avatar-5.png' },
|
||||||
description: 'Logistics management is now available',
|
description: 'Logistics management is now available',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -31,7 +33,7 @@ export const SampleNotifications = [
|
|||||||
createdAt: dayjs().subtract(7, 'minute').subtract(8, 'hour').subtract(7, 'day').toDate(),
|
createdAt: dayjs().subtract(7, 'minute').subtract(8, 'hour').subtract(7, 'day').toDate(),
|
||||||
read: true,
|
read: true,
|
||||||
type: 'new_company',
|
type: 'new_company',
|
||||||
author: { name: 'Jie Yan', avatar: '/assets/avatar-8.png' },
|
author: { id: '0001', collectionId: '002', name: 'Jie Yan', avatar: '/assets/avatar-8.png' },
|
||||||
company: { name: 'Stripe' },
|
company: { name: 'Stripe' },
|
||||||
},
|
},
|
||||||
] satisfies Notification[];
|
] satisfies Notification[];
|
||||||
|
@@ -9,18 +9,60 @@ import { Bell as BellIcon } from '@phosphor-icons/react/dist/ssr/Bell';
|
|||||||
import { usePopover } from '@/hooks/use-popover';
|
import { usePopover } from '@/hooks/use-popover';
|
||||||
|
|
||||||
import { NotificationsPopover } from '../../notifications-popover';
|
import { NotificationsPopover } from '../../notifications-popover';
|
||||||
|
import { logger } from '@/lib/default-logger';
|
||||||
// import { NotificationsButton } from './notifications-button';
|
// import { NotificationsButton } from './notifications-button';
|
||||||
|
import { toast } from '@/components/core/toaster';
|
||||||
|
import { MarkOneAsRead } from '@/db/Notifications/mark-one-as-read';
|
||||||
|
import { getUnreadNotificationsByUserId } from '@/db/Notifications/GetUnreadNotificationsByUserId';
|
||||||
|
import { Notification } from '@/db/Notifications/type';
|
||||||
|
import { useUser } from '@/hooks/use-user';
|
||||||
|
|
||||||
export function NotificationsButton(): React.JSX.Element {
|
export function NotificationsButton(): React.JSX.Element {
|
||||||
const popover = usePopover<HTMLButtonElement>();
|
const popover = usePopover<HTMLButtonElement>();
|
||||||
|
const { user } = useUser();
|
||||||
|
|
||||||
|
const [loading, setLoading] = React.useState(true);
|
||||||
|
const [showError, setShowError] = React.useState<boolean>(false);
|
||||||
|
const [listLength, setListLength] = React.useState<number>(0);
|
||||||
|
|
||||||
|
const [notiList, setNotiList] = React.useState<Notification[]>([]);
|
||||||
|
|
||||||
|
function handleMarkAllAsRead(): void {
|
||||||
|
// try {
|
||||||
|
// await MarkOneAsRead(id);
|
||||||
|
// toast.success('Notification marked as read');
|
||||||
|
// } catch (error) {
|
||||||
|
// logger.debug(error);
|
||||||
|
// toast.error('Something went wrong');
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleRemoveOne(id: string, cb: () => void): void {
|
||||||
|
MarkOneAsRead(id)
|
||||||
|
.then(() => {
|
||||||
|
toast.success('Notification marked as read');
|
||||||
|
cb();
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
logger.debug(error);
|
||||||
|
toast.error('Something went wrong');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<Tooltip title="Notifications">
|
<Tooltip title="Notifications">
|
||||||
<Badge
|
<Badge
|
||||||
color="error"
|
color="error"
|
||||||
sx={{ '& .MuiBadge-dot': { borderRadius: '50%', height: '10px', right: '6px', top: '6px', width: '10px' } }}
|
sx={{
|
||||||
variant="dot"
|
'& .MuiBadge-badge': {
|
||||||
|
height: '20px',
|
||||||
|
width: '20px',
|
||||||
|
right: '6px',
|
||||||
|
top: '6px',
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
badgeContent={listLength}
|
||||||
>
|
>
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={popover.handleOpen}
|
onClick={popover.handleOpen}
|
||||||
@@ -30,10 +72,14 @@ export function NotificationsButton(): React.JSX.Element {
|
|||||||
</IconButton>
|
</IconButton>
|
||||||
</Badge>
|
</Badge>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
{/* */}
|
||||||
<NotificationsPopover
|
<NotificationsPopover
|
||||||
anchorEl={popover.anchorRef.current}
|
anchorEl={popover.anchorRef.current}
|
||||||
onClose={popover.handleClose}
|
onClose={popover.handleClose}
|
||||||
open={popover.open}
|
open={popover.open}
|
||||||
|
onMarkAllAsRead={handleMarkAllAsRead}
|
||||||
|
onRemoveOne={handleRemoveOne}
|
||||||
|
setListLength={setListLength}
|
||||||
/>
|
/>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
|
@@ -1,14 +1,18 @@
|
|||||||
//
|
//
|
||||||
// RULES:
|
// RULES:
|
||||||
// api method for get notifications by user id
|
// api method for get notifications by user id
|
||||||
import { pb } from '@/lib/pb';
|
|
||||||
import { COL_NOTIFICATIONS } from '@/constants';
|
import { COL_NOTIFICATIONS } from '@/constants';
|
||||||
|
|
||||||
|
import { pb } from '@/lib/pb';
|
||||||
|
|
||||||
import type { Notification } from './type.d';
|
import type { Notification } from './type.d';
|
||||||
|
|
||||||
export async function getNotificationsByUserId(userId: string): Promise<Notification[]> {
|
export async function getNotificationsByUserId(userId: string): Promise<Notification[]> {
|
||||||
const records = await pb.collection(COL_NOTIFICATIONS).getFullList({
|
const records = await pb.collection(COL_NOTIFICATIONS).getFullList({
|
||||||
filter: `author.id = "000000000000001"`,
|
expand: 'author, to_user_id',
|
||||||
|
filter: `to_user_id.id = "${userId}"`,
|
||||||
sort: '-created',
|
sort: '-created',
|
||||||
});
|
});
|
||||||
|
|
||||||
return records as unknown as Notification[];
|
return records as unknown as Notification[];
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,20 @@
|
|||||||
|
//
|
||||||
|
// RULES:
|
||||||
|
// api method for get notifications by user id
|
||||||
|
import { COL_NOTIFICATIONS } from '@/constants';
|
||||||
|
|
||||||
|
import { pb } from '@/lib/pb';
|
||||||
|
|
||||||
|
import type { Notification } from './type.d';
|
||||||
|
|
||||||
|
export async function getUnreadNotificationsByUserId(userId: string): Promise<Notification[]> {
|
||||||
|
const records = await pb.collection(COL_NOTIFICATIONS).getFullList({
|
||||||
|
expand: 'author, to_user_id',
|
||||||
|
filter: `to_user_id.id = "${userId}" && read = false`,
|
||||||
|
sort: '-created',
|
||||||
|
cache: 'no-cache',
|
||||||
|
requestKey: null,
|
||||||
|
});
|
||||||
|
|
||||||
|
return records as unknown as Notification[];
|
||||||
|
}
|
11
002_source/cms/src/db/Notifications/mark-one-as-read.tsx
Normal file
11
002_source/cms/src/db/Notifications/mark-one-as-read.tsx
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// api method for update notification record
|
||||||
|
// RULES:
|
||||||
|
// TBA
|
||||||
|
import { pb } from '@/lib/pb';
|
||||||
|
import { COL_NOTIFICATIONS } from '@/constants';
|
||||||
|
import type { RecordModel } from 'pocketbase';
|
||||||
|
import type { NotificationFormProps } from '@/components/dashboard/notification/type.d';
|
||||||
|
|
||||||
|
export async function MarkOneAsRead(id: string): Promise<RecordModel> {
|
||||||
|
return pb.collection(COL_NOTIFICATIONS).update(id, { read: true });
|
||||||
|
}
|
16
002_source/cms/src/db/Notifications/type.d.ts
vendored
16
002_source/cms/src/db/Notifications/type.d.ts
vendored
@@ -1,17 +1,21 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
|
import type { User } from '@/types/user';
|
||||||
|
|
||||||
export type SortDir = 'asc' | 'desc';
|
export type SortDir = 'asc' | 'desc';
|
||||||
|
|
||||||
export interface Notification {
|
export interface Notification {
|
||||||
id: string;
|
id: string;
|
||||||
|
created: string;
|
||||||
|
createdAt: Date;
|
||||||
read: boolean;
|
read: boolean;
|
||||||
type: string;
|
type: string;
|
||||||
author: Record<string, unknown>;
|
author?: User;
|
||||||
job: Record<string, unknown>;
|
job?: { title: string };
|
||||||
description: string;
|
description?: string;
|
||||||
NOTI_ID: string;
|
company?: { name: string };
|
||||||
created: string;
|
to_user_id?: User;
|
||||||
updated: string;
|
link: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreateFormProps {
|
export interface CreateFormProps {
|
||||||
|
14
002_source/docker/.env
Normal file
14
002_source/docker/.env
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# THIS IS env file for use with docker-compose.yml
|
||||||
|
|
||||||
|
# cms
|
||||||
|
|
||||||
|
# doc
|
||||||
|
|
||||||
|
# ionic_mobile
|
||||||
|
|
||||||
|
# api_ts
|
||||||
|
|
||||||
|
# pocketbase
|
||||||
|
PB_HOSTNAME=pocketbase
|
||||||
|
PB_USERNAME=admin@123.com
|
||||||
|
PB_PASSWORD=Aa12345678
|
35
002_source/docker/docker-compose.db.yml
Normal file
35
002_source/docker/docker-compose.db.yml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
volumes:
|
||||||
|
shared:
|
||||||
|
dist:
|
||||||
|
|
||||||
|
services:
|
||||||
|
pocketbase:
|
||||||
|
# image: ghcr.io/muchobien/pocketbase:latest
|
||||||
|
build:
|
||||||
|
context: ./pocketbase/docker
|
||||||
|
args:
|
||||||
|
- VERSION=0.26.6 # Specify the PocketBase version here
|
||||||
|
# hostname: pocketbase
|
||||||
|
restart: always
|
||||||
|
# environment:
|
||||||
|
# ENCRYPTION: example #optional
|
||||||
|
ports:
|
||||||
|
- 8090:8090
|
||||||
|
volumes:
|
||||||
|
- ./volumes/pocketbase/pb_data:/pb_data
|
||||||
|
#
|
||||||
|
- ../pocketbase/pb_migrations:/pb_migrations
|
||||||
|
- ../pocketbase/pb_hooks:/pb_hooks
|
||||||
|
# healthcheck:
|
||||||
|
# #optional (recommended) since v0.10.0
|
||||||
|
# test: wget --no-verbose --tries=1 --spider http://localhost:8090/api/health || exit 1
|
||||||
|
# interval: 5s
|
||||||
|
# timeout: 5s
|
||||||
|
# retries: 5
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: 0.5
|
||||||
|
reservations:
|
||||||
|
cpus: 0.01
|
@@ -6,7 +6,7 @@ services:
|
|||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: "1"
|
cpus: '1'
|
||||||
|
|
||||||
doc:
|
doc:
|
||||||
environment:
|
environment:
|
||||||
@@ -14,7 +14,7 @@ services:
|
|||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: "1"
|
cpus: '1'
|
||||||
|
|
||||||
ionic_mobile:
|
ionic_mobile:
|
||||||
environment:
|
environment:
|
||||||
@@ -22,7 +22,7 @@ services:
|
|||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: "1"
|
cpus: '1'
|
||||||
|
|
||||||
api_ts:
|
api_ts:
|
||||||
environment:
|
environment:
|
||||||
@@ -30,4 +30,4 @@ services:
|
|||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: "1"
|
cpus: '1'
|
120
002_source/docker/docker-compose.yml
Normal file
120
002_source/docker/docker-compose.yml
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
volumes:
|
||||||
|
shared:
|
||||||
|
dist:
|
||||||
|
|
||||||
|
services:
|
||||||
|
cms:
|
||||||
|
image: 192.168.10.61:5000/cms_ubuntu
|
||||||
|
# build: ./cms
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
volumes:
|
||||||
|
- ./cms:/app
|
||||||
|
ports:
|
||||||
|
- 3000:3000
|
||||||
|
working_dir: /app
|
||||||
|
command: ./scripts/docker/entrypoint.sh
|
||||||
|
depends_on:
|
||||||
|
pocketbase:
|
||||||
|
condition: service_healthy
|
||||||
|
healthcheck:
|
||||||
|
#optional (recommended) since v0.10.0
|
||||||
|
test: wget --no-verbose --tries=1 --spider http://localhost:3000 || exit 1
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '0.5'
|
||||||
|
reservations:
|
||||||
|
cpus: '0.01'
|
||||||
|
|
||||||
|
doc:
|
||||||
|
build: ./doc
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
volumes:
|
||||||
|
- ./doc:/app
|
||||||
|
ports:
|
||||||
|
- 3001:3000
|
||||||
|
working_dir: /app
|
||||||
|
command: ./scripts/docker/entrypoint.sh
|
||||||
|
healthcheck:
|
||||||
|
#optional (recommended) since v0.10.0
|
||||||
|
test: wget --no-verbose --tries=1 --spider http://localhost:3000 || exit 1
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '0.5'
|
||||||
|
reservations:
|
||||||
|
cpus: '0.01'
|
||||||
|
|
||||||
|
ionic_mobile:
|
||||||
|
# image: node:20-bullseye-slim
|
||||||
|
# build: ./ionic_mobile
|
||||||
|
image: 192.168.10.61:5000/ionic_mobile_ubuntu
|
||||||
|
# user: 1000:1000
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
volumes:
|
||||||
|
- ./ionic_mobile:/app
|
||||||
|
ports:
|
||||||
|
- 5173:5173
|
||||||
|
working_dir: /app
|
||||||
|
command: ./scripts/docker/entrypoint.sh
|
||||||
|
depends_on:
|
||||||
|
pocketbase:
|
||||||
|
condition: service_healthy
|
||||||
|
healthcheck:
|
||||||
|
#optional (recommended) since v0.10.0
|
||||||
|
test: wget --no-verbose --tries=1 --spider http://localhost:5173 || exit 1
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '0.5'
|
||||||
|
reservations:
|
||||||
|
cpus: '0.01'
|
||||||
|
|
||||||
|
api_ts:
|
||||||
|
# TODO: review this config, the api_ts volumes should be place inside 002_source/docker/volumes
|
||||||
|
image: 192.168.10.61:5000/api_ts_ubuntu
|
||||||
|
# build: ./api_ts
|
||||||
|
volumes:
|
||||||
|
- ../api_ts:/app
|
||||||
|
working_dir: /app
|
||||||
|
# env_file:
|
||||||
|
# - .env
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=production
|
||||||
|
- PB_HOSTNAME=pocketbase
|
||||||
|
- PB_USERNAME=admin@123.com
|
||||||
|
- PB_PASSWORD=Aa12345678
|
||||||
|
ports:
|
||||||
|
- 8080:3000
|
||||||
|
# command: sleep infinity
|
||||||
|
command: ./entrypoint.sh
|
||||||
|
# depends_on:
|
||||||
|
# pocketbase:
|
||||||
|
# condition: service_healthy
|
||||||
|
# healthcheck:
|
||||||
|
# #optional (recommended) since v0.10.0
|
||||||
|
# test: wget --no-verbose --tries=1 --spider http://localhost:3000 || exit 1
|
||||||
|
# interval: 5s
|
||||||
|
# timeout: 5s
|
||||||
|
# retries: 5
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: 0.5
|
||||||
|
reservations:
|
||||||
|
cpus: 0.01
|
1
002_source/ionic_mobile/.gitignore
vendored
1
002_source/ionic_mobile/.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
|
.env
|
||||||
**/*.log
|
**/*.log
|
||||||
**/*.del
|
**/*.del
|
||||||
**/*.bak
|
**/*.bak
|
||||||
|
@@ -1,9 +1,10 @@
|
|||||||
{
|
{
|
||||||
|
"endOfLine": "lf",
|
||||||
"printWidth": 120,
|
"printWidth": 120,
|
||||||
"quoteProps": "consistent",
|
"quoteProps": "consistent",
|
||||||
"semi": true,
|
"semi": true,
|
||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
"tabWidth": 2,
|
"tabWidth": 2,
|
||||||
"trailingComma": "all",
|
"trailingComma": "es5",
|
||||||
"plugins": ["prettier-plugin-organize-imports", "prettier-plugin-unused-imports-configurable"]
|
"plugins": []
|
||||||
}
|
}
|
||||||
|
3
002_source/ionic_mobile/TODO.md
Normal file
3
002_source/ionic_mobile/TODO.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# TODO
|
||||||
|
|
||||||
|
- [ ] add login mechanism
|
@@ -1,8 +1,8 @@
|
|||||||
import { defineConfig } from "cypress";
|
import { defineConfig } from 'cypress';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
e2e: {
|
e2e: {
|
||||||
baseUrl: "http://localhost:5173",
|
baseUrl: 'http://localhost:5173',
|
||||||
setupNodeEvents(on, config) {
|
setupNodeEvents(on, config) {
|
||||||
// implement node event listeners here
|
// implement node event listeners here
|
||||||
},
|
},
|
||||||
|
17
002_source/ionic_mobile/default.code-workspace
Normal file
17
002_source/ionic_mobile/default.code-workspace
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"folders": [
|
||||||
|
{
|
||||||
|
"path": ".",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./../../001_documentation",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../000_AI_WORKSPACE",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"git.ignoreLimitWarning": true,
|
||||||
|
"remote.autoForwardPortsFallback": 0,
|
||||||
|
},
|
||||||
|
}
|
@@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
{
|
{
|
||||||
"watch": ["src"],
|
"watch": [
|
||||||
|
"src"
|
||||||
|
],
|
||||||
"ext": "ts,tsx",
|
"ext": "ts,tsx",
|
||||||
"exec": "npm run bulid"
|
"exec": "npm run bulid"
|
||||||
}
|
}
|
||||||
|
453
002_source/ionic_mobile/package-lock.json
generated
453
002_source/ionic_mobile/package-lock.json
generated
@@ -21,11 +21,14 @@
|
|||||||
"@ionic/react-router": "^8.0.0",
|
"@ionic/react-router": "^8.0.0",
|
||||||
"@ionic/storage": "^4.0.0",
|
"@ionic/storage": "^4.0.0",
|
||||||
"@lifeomic/attempt": "^3.1.0",
|
"@lifeomic/attempt": "^3.1.0",
|
||||||
|
"@tanstack/react-query": "^5.74.4",
|
||||||
|
"@tanstack/react-query-devtools": "^5.74.6",
|
||||||
"@types/react-router": "^5.1.20",
|
"@types/react-router": "^5.1.20",
|
||||||
"@types/react-router-dom": "^5.3.3",
|
"@types/react-router-dom": "^5.3.3",
|
||||||
"axios": "^1.8.1",
|
"axios": "^1.8.1",
|
||||||
"i18next": "^24.2.2",
|
"i18next": "^24.2.2",
|
||||||
"ionicons": "^7.0.0",
|
"ionicons": "^7.0.0",
|
||||||
|
"pocketbase": "^0.26.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-i18next": "^15.4.1",
|
"react-i18next": "^15.4.1",
|
||||||
@@ -55,6 +58,7 @@
|
|||||||
"prettier": "^3.4.2",
|
"prettier": "^3.4.2",
|
||||||
"prettier-plugin-organize-imports": "^4.1.0",
|
"prettier-plugin-organize-imports": "^4.1.0",
|
||||||
"prettier-plugin-unused-imports-configurable": "^1.14.2",
|
"prettier-plugin-unused-imports-configurable": "^1.14.2",
|
||||||
|
"sass": "^1.88.0",
|
||||||
"terser": "^5.4.0",
|
"terser": "^5.4.0",
|
||||||
"typescript": "^5.1.6",
|
"typescript": "^5.1.6",
|
||||||
"vite": "~5.2.0",
|
"vite": "~5.2.0",
|
||||||
@@ -2777,6 +2781,338 @@
|
|||||||
"node": ">= 8"
|
"node": ">= 8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@parcel/watcher": {
|
||||||
|
"version": "2.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.1.tgz",
|
||||||
|
"integrity": "sha512-dfUnCxiN9H4ap84DvD2ubjw+3vUNpstxa0TneY/Paat8a3R4uQZDLSvWjmznAY/DoahqTHl9V46HF/Zs3F29pg==",
|
||||||
|
"dev": true,
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"detect-libc": "^1.0.3",
|
||||||
|
"is-glob": "^4.0.3",
|
||||||
|
"micromatch": "^4.0.5",
|
||||||
|
"node-addon-api": "^7.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@parcel/watcher-android-arm64": "2.5.1",
|
||||||
|
"@parcel/watcher-darwin-arm64": "2.5.1",
|
||||||
|
"@parcel/watcher-darwin-x64": "2.5.1",
|
||||||
|
"@parcel/watcher-freebsd-x64": "2.5.1",
|
||||||
|
"@parcel/watcher-linux-arm-glibc": "2.5.1",
|
||||||
|
"@parcel/watcher-linux-arm-musl": "2.5.1",
|
||||||
|
"@parcel/watcher-linux-arm64-glibc": "2.5.1",
|
||||||
|
"@parcel/watcher-linux-arm64-musl": "2.5.1",
|
||||||
|
"@parcel/watcher-linux-x64-glibc": "2.5.1",
|
||||||
|
"@parcel/watcher-linux-x64-musl": "2.5.1",
|
||||||
|
"@parcel/watcher-win32-arm64": "2.5.1",
|
||||||
|
"@parcel/watcher-win32-ia32": "2.5.1",
|
||||||
|
"@parcel/watcher-win32-x64": "2.5.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@parcel/watcher-android-arm64": {
|
||||||
|
"version": "2.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.5.1.tgz",
|
||||||
|
"integrity": "sha512-KF8+j9nNbUN8vzOFDpRMsaKBHZ/mcjEjMToVMJOhTozkDonQFFrRcfdLWn6yWKCmJKmdVxSgHiYvTCef4/qcBA==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"android"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@parcel/watcher-darwin-arm64": {
|
||||||
|
"version": "2.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.5.1.tgz",
|
||||||
|
"integrity": "sha512-eAzPv5osDmZyBhou8PoF4i6RQXAfeKL9tjb3QzYuccXFMQU0ruIc/POh30ePnaOyD1UXdlKguHBmsTs53tVoPw==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@parcel/watcher-darwin-x64": {
|
||||||
|
"version": "2.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.5.1.tgz",
|
||||||
|
"integrity": "sha512-1ZXDthrnNmwv10A0/3AJNZ9JGlzrF82i3gNQcWOzd7nJ8aj+ILyW1MTxVk35Db0u91oD5Nlk9MBiujMlwmeXZg==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@parcel/watcher-freebsd-x64": {
|
||||||
|
"version": "2.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.5.1.tgz",
|
||||||
|
"integrity": "sha512-SI4eljM7Flp9yPuKi8W0ird8TI/JK6CSxju3NojVI6BjHsTyK7zxA9urjVjEKJ5MBYC+bLmMcbAWlZ+rFkLpJQ==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"freebsd"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@parcel/watcher-linux-arm-glibc": {
|
||||||
|
"version": "2.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.5.1.tgz",
|
||||||
|
"integrity": "sha512-RCdZlEyTs8geyBkkcnPWvtXLY44BCeZKmGYRtSgtwwnHR4dxfHRG3gR99XdMEdQ7KeiDdasJwwvNSF5jKtDwdA==",
|
||||||
|
"cpu": [
|
||||||
|
"arm"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@parcel/watcher-linux-arm-musl": {
|
||||||
|
"version": "2.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-musl/-/watcher-linux-arm-musl-2.5.1.tgz",
|
||||||
|
"integrity": "sha512-6E+m/Mm1t1yhB8X412stiKFG3XykmgdIOqhjWj+VL8oHkKABfu/gjFj8DvLrYVHSBNC+/u5PeNrujiSQ1zwd1Q==",
|
||||||
|
"cpu": [
|
||||||
|
"arm"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@parcel/watcher-linux-arm64-glibc": {
|
||||||
|
"version": "2.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.5.1.tgz",
|
||||||
|
"integrity": "sha512-LrGp+f02yU3BN9A+DGuY3v3bmnFUggAITBGriZHUREfNEzZh/GO06FF5u2kx8x+GBEUYfyTGamol4j3m9ANe8w==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@parcel/watcher-linux-arm64-musl": {
|
||||||
|
"version": "2.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.5.1.tgz",
|
||||||
|
"integrity": "sha512-cFOjABi92pMYRXS7AcQv9/M1YuKRw8SZniCDw0ssQb/noPkRzA+HBDkwmyOJYp5wXcsTrhxO0zq1U11cK9jsFg==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@parcel/watcher-linux-x64-glibc": {
|
||||||
|
"version": "2.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.5.1.tgz",
|
||||||
|
"integrity": "sha512-GcESn8NZySmfwlTsIur+49yDqSny2IhPeZfXunQi48DMugKeZ7uy1FX83pO0X22sHntJ4Ub+9k34XQCX+oHt2A==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@parcel/watcher-linux-x64-musl": {
|
||||||
|
"version": "2.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.5.1.tgz",
|
||||||
|
"integrity": "sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@parcel/watcher-win32-arm64": {
|
||||||
|
"version": "2.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.5.1.tgz",
|
||||||
|
"integrity": "sha512-RFzklRvmc3PkjKjry3hLF9wD7ppR4AKcWNzH7kXR7GUe0Igb3Nz8fyPwtZCSquGrhU5HhUNDr/mKBqj7tqA2Vw==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@parcel/watcher-win32-ia32": {
|
||||||
|
"version": "2.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.5.1.tgz",
|
||||||
|
"integrity": "sha512-c2KkcVN+NJmuA7CGlaGD1qJh1cLfDnQsHjE89E60vUEMlqduHGCdCLJCID5geFVM0dOtA3ZiIO8BoEQmzQVfpQ==",
|
||||||
|
"cpu": [
|
||||||
|
"ia32"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@parcel/watcher-win32-x64": {
|
||||||
|
"version": "2.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.5.1.tgz",
|
||||||
|
"integrity": "sha512-9lHBdJITeNR++EvSQVUcaZoWupyHfXe1jZvGZ06O/5MflPcuPLtEphScIBL+AiCWBO46tDSHzWyD0uDmmZqsgA==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@parcel/watcher/node_modules/detect-libc": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"optional": true,
|
||||||
|
"bin": {
|
||||||
|
"detect-libc": "bin/detect-libc.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@parcel/watcher/node_modules/node-addon-api": {
|
||||||
|
"version": "7.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz",
|
||||||
|
"integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
"node_modules/@prettier/plugin-xml": {
|
"node_modules/@prettier/plugin-xml": {
|
||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@prettier/plugin-xml/-/plugin-xml-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@prettier/plugin-xml/-/plugin-xml-2.2.0.tgz",
|
||||||
@@ -2836,6 +3172,59 @@
|
|||||||
"npm": ">=7.10.0"
|
"npm": ">=7.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@tanstack/query-core": {
|
||||||
|
"version": "5.74.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.74.7.tgz",
|
||||||
|
"integrity": "sha512-X3StkN/Y6KGHndTjJf8H8th7AX4bKfbRpiVhVqevf0QWlxl6DhyJ0TYG3R0LARa/+xqDwzU9mA4pbJxzPCI29A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/tannerlinsley"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@tanstack/query-devtools": {
|
||||||
|
"version": "5.74.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tanstack/query-devtools/-/query-devtools-5.74.7.tgz",
|
||||||
|
"integrity": "sha512-nSNlfuGdnHf4yB0S+BoNYOE1o3oAH093weAYZolIHfS2stulyA/gWfSk/9H4ZFk5mAAHb5vNqAeJOmbdcGPEQw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/tannerlinsley"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@tanstack/react-query": {
|
||||||
|
"version": "5.74.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.74.7.tgz",
|
||||||
|
"integrity": "sha512-u4o/RIWnnrq26orGZu2NDPwmVof1vtAiiV6KYUXd49GuK+8HX+gyxoAYqIaZogvCE1cqOuZAhQKcrKGYGkrLxg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@tanstack/query-core": "5.74.7"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/tannerlinsley"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^18 || ^19"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@tanstack/react-query-devtools": {
|
||||||
|
"version": "5.74.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tanstack/react-query-devtools/-/react-query-devtools-5.74.7.tgz",
|
||||||
|
"integrity": "sha512-j60esTQF+ES0x52kQUYOX0Z8AJUcqCGANj6GaOf8J3YQz2bZPB1imLSw4SFeM3Ozv8uO/X/Dmh3IT1z+y57ZLQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@tanstack/query-devtools": "5.74.7"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/tannerlinsley"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@tanstack/react-query": "^5.74.7",
|
||||||
|
"react": "^18 || ^19"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@testing-library/dom": {
|
"node_modules/@testing-library/dom": {
|
||||||
"version": "10.4.0",
|
"version": "10.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.0.tgz",
|
||||||
@@ -4781,6 +5170,22 @@
|
|||||||
"regexp-to-ast": "0.5.0"
|
"regexp-to-ast": "0.5.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/chokidar": {
|
||||||
|
"version": "4.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz",
|
||||||
|
"integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"readdirp": "^4.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 14.16.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://paulmillr.com/funding/"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/chownr": {
|
"node_modules/chownr": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
|
||||||
@@ -8843,6 +9248,13 @@
|
|||||||
"integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==",
|
"integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/immutable": {
|
||||||
|
"version": "5.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/immutable/-/immutable-5.1.2.tgz",
|
||||||
|
"integrity": "sha512-qHKXW1q6liAk1Oys6umoaZbDRqjcjgSrbnrifHsfsttza7zcvRAsL7mMV6xWcyhwQy7Xj5v4hhbr6b+iDYwlmQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/import-fresh": {
|
"node_modules/import-fresh": {
|
||||||
"version": "3.3.0",
|
"version": "3.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
|
||||||
@@ -12281,6 +12693,12 @@
|
|||||||
"node": ">=10.4.0"
|
"node": ">=10.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/pocketbase": {
|
||||||
|
"version": "0.26.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pocketbase/-/pocketbase-0.26.0.tgz",
|
||||||
|
"integrity": "sha512-WBBeOgz4Jnrd7a1KEzSBUJqpTortKKCcp16j5KoF+4tNIyQHsmynj+qRSvS56/RVacVMbAqO8Qkfj3N84fpzEw==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/possible-typed-array-names": {
|
"node_modules/possible-typed-array-names": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz",
|
||||||
@@ -13023,6 +13441,20 @@
|
|||||||
"node": ">= 6"
|
"node": ">= 6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/readdirp": {
|
||||||
|
"version": "4.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz",
|
||||||
|
"integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 14.18.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://paulmillr.com/funding/"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/redent": {
|
"node_modules/redent": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz",
|
||||||
@@ -13824,6 +14256,27 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/sass": {
|
||||||
|
"version": "1.88.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/sass/-/sass-1.88.0.tgz",
|
||||||
|
"integrity": "sha512-sF6TWQqjFvr4JILXzG4ucGOLELkESHL+I5QJhh7CNaE+Yge0SI+ehCatsXhJ7ymU1hAFcIS3/PBpjdIbXoyVbg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"chokidar": "^4.0.0",
|
||||||
|
"immutable": "^5.0.2",
|
||||||
|
"source-map-js": ">=0.6.2 <2.0.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"sass": "sass.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.0.0"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@parcel/watcher": "^2.4.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/sax": {
|
"node_modules/sax": {
|
||||||
"version": "1.1.4",
|
"version": "1.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/sax/-/sax-1.1.4.tgz",
|
||||||
|
@@ -36,11 +36,14 @@
|
|||||||
"@ionic/react-router": "^8.0.0",
|
"@ionic/react-router": "^8.0.0",
|
||||||
"@ionic/storage": "^4.0.0",
|
"@ionic/storage": "^4.0.0",
|
||||||
"@lifeomic/attempt": "^3.1.0",
|
"@lifeomic/attempt": "^3.1.0",
|
||||||
|
"@tanstack/react-query": "^5.74.4",
|
||||||
|
"@tanstack/react-query-devtools": "^5.74.6",
|
||||||
"@types/react-router": "^5.1.20",
|
"@types/react-router": "^5.1.20",
|
||||||
"@types/react-router-dom": "^5.3.3",
|
"@types/react-router-dom": "^5.3.3",
|
||||||
"axios": "^1.8.1",
|
"axios": "^1.8.1",
|
||||||
"i18next": "^24.2.2",
|
"i18next": "^24.2.2",
|
||||||
"ionicons": "^7.0.0",
|
"ionicons": "^7.0.0",
|
||||||
|
"pocketbase": "^0.26.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-i18next": "^15.4.1",
|
"react-i18next": "^15.4.1",
|
||||||
@@ -70,6 +73,7 @@
|
|||||||
"prettier": "^3.4.2",
|
"prettier": "^3.4.2",
|
||||||
"prettier-plugin-organize-imports": "^4.1.0",
|
"prettier-plugin-organize-imports": "^4.1.0",
|
||||||
"prettier-plugin-unused-imports-configurable": "^1.14.2",
|
"prettier-plugin-unused-imports-configurable": "^1.14.2",
|
||||||
|
"sass": "^1.88.0",
|
||||||
"terser": "^5.4.0",
|
"terser": "^5.4.0",
|
||||||
"typescript": "^5.1.6",
|
"typescript": "^5.1.6",
|
||||||
"vite": "~5.2.0",
|
"vite": "~5.2.0",
|
||||||
@@ -79,4 +83,4 @@
|
|||||||
"engines": {
|
"engines": {
|
||||||
"node": "==18"
|
"node": "==18"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BIN
002_source/ionic_mobile/public/assets/login2.jpeg
Normal file
BIN
002_source/ionic_mobile/public/assets/login2.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 296 KiB |
5
002_source/ionic_mobile/scripts/004_dev.sh
Executable file
5
002_source/ionic_mobile/scripts/004_dev.sh
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
npm run dev
|
8
002_source/ionic_mobile/scripts/010_rsync_backup.sh
Executable file
8
002_source/ionic_mobile/scripts/010_rsync_backup.sh
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
rsync -avh --exclude="node_modules" ../ionic_mobile/ \
|
||||||
|
../_archive/ionic_mobile_draft_012
|
||||||
|
|
||||||
|
echo "done"
|
8
002_source/ionic_mobile/scripts/999_express_commit.sh
Executable file
8
002_source/ionic_mobile/scripts/999_express_commit.sh
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
git add src
|
||||||
|
git commit -m'update,'
|
||||||
|
|
||||||
|
echo "done"
|
@@ -21,6 +21,10 @@ import ConnectivesWordPage from './pages/Favorite/ConnectivesWordPage';
|
|||||||
import FavVocabularyPage from './pages/Favorite/Vocabulary';
|
import FavVocabularyPage from './pages/Favorite/Vocabulary';
|
||||||
import FavoriteVocabularyPage from './pages/Favorite/WordPage';
|
import FavoriteVocabularyPage from './pages/Favorite/WordPage';
|
||||||
import ConnectivesPage from './pages/Lesson/ConnectivesPage';
|
import ConnectivesPage from './pages/Lesson/ConnectivesPage';
|
||||||
|
import AuthHome from './pages/auth/Home';
|
||||||
|
import { AuthLogin } from './pages/auth/Login';
|
||||||
|
import { AuthSignUp } from './pages/auth/SignUp';
|
||||||
|
|
||||||
import Lesson from './pages/Lesson/index';
|
import Lesson from './pages/Lesson/index';
|
||||||
|
|
||||||
// NOTES: old version using json file
|
// NOTES: old version using json file
|
||||||
@@ -88,6 +92,7 @@ function RouteConfig() {
|
|||||||
<ListeningPractice />
|
<ListeningPractice />
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
|
{/* http://localhost:5173/connective_revision/r/000000000000001 */}
|
||||||
<Route exact path={`${CONNECTIVE_REVISION_LINK}/r/:p_route`}>
|
<Route exact path={`${CONNECTIVE_REVISION_LINK}/r/:p_route`}>
|
||||||
<ConnectiveRevisionQuizRun />
|
<ConnectiveRevisionQuizRun />
|
||||||
</Route>
|
</Route>
|
||||||
@@ -96,6 +101,7 @@ function RouteConfig() {
|
|||||||
<ConnectiveRevisionQuizResult />
|
<ConnectiveRevisionQuizResult />
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
|
{/* http://localhost:5173/connective_revision */}
|
||||||
<Route exact path={CONNECTIVE_REVISION_LINK}>
|
<Route exact path={CONNECTIVE_REVISION_LINK}>
|
||||||
<ConnectiveRevisionSelectCategory />
|
<ConnectiveRevisionSelectCategory />
|
||||||
</Route>
|
</Route>
|
||||||
@@ -154,6 +160,18 @@ function RouteConfig() {
|
|||||||
<ConnectivesPage />
|
<ConnectivesPage />
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
|
<Route exact path={`/auth/Home`}>
|
||||||
|
<AuthHome />
|
||||||
|
</Route>
|
||||||
|
|
||||||
|
<Route exact path={`/auth/login`}>
|
||||||
|
<AuthLogin />
|
||||||
|
</Route>
|
||||||
|
|
||||||
|
<Route exact path={`/auth/signup`}>
|
||||||
|
<AuthSignUp />
|
||||||
|
</Route>
|
||||||
|
|
||||||
{/* TODO: remove below */}
|
{/* TODO: remove below */}
|
||||||
<Route exact path="/tab1">
|
<Route exact path="/tab1">
|
||||||
<Tab1 />
|
<Tab1 />
|
||||||
|
21
002_source/ionic_mobile/src/components/Action/index.tsx
Normal file
21
002_source/ionic_mobile/src/components/Action/index.tsx
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import { IonCol, IonRouterLink, IonRow } from '@ionic/react';
|
||||||
|
|
||||||
|
function Action(props: { message: string; text: string; link: string }): React.JSX.Element {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<IonRow className="ion-text-center ion-justify-content-center">
|
||||||
|
<IonCol size="12">
|
||||||
|
<p>
|
||||||
|
{props.message}
|
||||||
|
<IonRouterLink className="custom-link" routerLink={props.link}>
|
||||||
|
{' '}
|
||||||
|
{props.text} →
|
||||||
|
</IonRouterLink>
|
||||||
|
</p>
|
||||||
|
</IonCol>
|
||||||
|
</IonRow>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Action };
|
40
002_source/ionic_mobile/src/components/CustomField/index.tsx
Normal file
40
002_source/ionic_mobile/src/components/CustomField/index.tsx
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import { IonInput, IonLabel } from '@ionic/react';
|
||||||
|
import styles from './style.module.scss';
|
||||||
|
|
||||||
|
function CustomField({
|
||||||
|
field,
|
||||||
|
errors,
|
||||||
|
}: {
|
||||||
|
field: {
|
||||||
|
id: string;
|
||||||
|
label: string;
|
||||||
|
required: boolean;
|
||||||
|
input: {
|
||||||
|
props: { type: string; placeholder: string };
|
||||||
|
state: {
|
||||||
|
value: string;
|
||||||
|
reset: (newValue: any) => void;
|
||||||
|
onIonChange: (e: any) => Promise<void>;
|
||||||
|
onKeyUp: (e: any) => Promise<void>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
errors: any;
|
||||||
|
}): React.JSX.Element {
|
||||||
|
const error = errors && errors.filter((e) => e.id === field.id)[0];
|
||||||
|
const errorMessage = error && errors.filter((e) => e.id === field.id)[0].message;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className={styles.field}>
|
||||||
|
<IonLabel className={styles.fieldLabel}>
|
||||||
|
{field.label}
|
||||||
|
{error && <p className="animate__animated animate__bounceIn">{errorMessage}</p>}
|
||||||
|
</IonLabel>
|
||||||
|
<IonInput className={styles.customInput} {...field.input.props} {...field.input.state} />
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { CustomField };
|
@@ -0,0 +1,29 @@
|
|||||||
|
.field:not(:last-child) {
|
||||||
|
margin-bottom: 1rem !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field {
|
||||||
|
ion-label {
|
||||||
|
padding-left: 0.2rem;
|
||||||
|
padding-right: 0.5rem;
|
||||||
|
color: #d3a6c7;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
p {
|
||||||
|
color: rgb(236, 149, 35);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.customInput {
|
||||||
|
// --background: #834e76;
|
||||||
|
--padding-bottom: 1rem;
|
||||||
|
--padding-top: 1rem;
|
||||||
|
--padding-start: 1rem;
|
||||||
|
--padding-end: 1rem;
|
||||||
|
border-radius: 10px;
|
||||||
|
margin-top: 0.25rem;
|
||||||
|
transition: all 0.2s linear;
|
||||||
|
}
|
5
002_source/ionic_mobile/src/components/Helloworld.tsx
Normal file
5
002_source/ionic_mobile/src/components/Helloworld.tsx
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
function Helloworld(): React.JSX.Element {
|
||||||
|
return <>Helloworld Component</>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Helloworld };
|
9
002_source/ionic_mobile/src/components/Wave/index.tsx
Normal file
9
002_source/ionic_mobile/src/components/Wave/index.tsx
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
export const Wave = () => (
|
||||||
|
<svg style={{ marginBottom: '-0.5rem' }} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320">
|
||||||
|
<path
|
||||||
|
fill="#7a506f"
|
||||||
|
fillOpacity="1"
|
||||||
|
d="M0,288L40,277.3C80,267,160,245,240,224C320,203,400,181,480,176C560,171,640,181,720,181.3C800,181,880,171,960,144C1040,117,1120,75,1200,58.7C1280,43,1360,53,1400,58.7L1440,64L1440,320L1400,320C1360,320,1280,320,1200,320C1120,320,1040,320,960,320C880,320,800,320,720,320C640,320,560,320,480,320C400,320,320,320,240,320C160,320,80,320,40,320L0,320Z"
|
||||||
|
></path>
|
||||||
|
</svg>
|
||||||
|
);
|
71
002_source/ionic_mobile/src/data/fields.tsx
Normal file
71
002_source/ionic_mobile/src/data/fields.tsx
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
import { useFormInput } from './utils';
|
||||||
|
|
||||||
|
export const useSignupFields = () => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
id: 'name',
|
||||||
|
label: 'Name',
|
||||||
|
required: true,
|
||||||
|
input: {
|
||||||
|
props: {
|
||||||
|
type: 'text',
|
||||||
|
placeholder: 'Joe Bloggs',
|
||||||
|
},
|
||||||
|
state: useFormInput(''),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'email',
|
||||||
|
label: 'Email',
|
||||||
|
required: true,
|
||||||
|
input: {
|
||||||
|
props: {
|
||||||
|
type: 'email',
|
||||||
|
placeholder: 'joe@bloggs.com',
|
||||||
|
},
|
||||||
|
state: useFormInput(''),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'password',
|
||||||
|
label: 'Password',
|
||||||
|
required: true,
|
||||||
|
input: {
|
||||||
|
props: {
|
||||||
|
type: 'password',
|
||||||
|
placeholder: '*********',
|
||||||
|
},
|
||||||
|
state: useFormInput(''),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useLoginFields = () => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
id: 'email',
|
||||||
|
label: 'Email',
|
||||||
|
required: true,
|
||||||
|
input: {
|
||||||
|
props: {
|
||||||
|
type: 'email',
|
||||||
|
placeholder: 'joe@bloggs.com',
|
||||||
|
},
|
||||||
|
state: useFormInput(''),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'password',
|
||||||
|
label: 'Password',
|
||||||
|
required: true,
|
||||||
|
input: {
|
||||||
|
props: {
|
||||||
|
type: 'password',
|
||||||
|
placeholder: '*******',
|
||||||
|
},
|
||||||
|
state: useFormInput(''),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
};
|
38
002_source/ionic_mobile/src/data/utils.tsx
Normal file
38
002_source/ionic_mobile/src/data/utils.tsx
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
import { useState } from 'react';
|
||||||
|
|
||||||
|
export const useFormInput = (initialValue = '') => {
|
||||||
|
const [value, setValue] = useState(initialValue);
|
||||||
|
|
||||||
|
const handleChange = async (e) => {
|
||||||
|
const tempValue = await e.currentTarget.value;
|
||||||
|
setValue(tempValue);
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
value,
|
||||||
|
reset: (newValue) => setValue(newValue),
|
||||||
|
onIonChange: handleChange,
|
||||||
|
onKeyUp: handleChange,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const validateForm = (fields) => {
|
||||||
|
let errors = [];
|
||||||
|
|
||||||
|
fields.forEach((field) => {
|
||||||
|
if (field.required) {
|
||||||
|
const fieldValue = field.input.state.value;
|
||||||
|
|
||||||
|
if (fieldValue === '') {
|
||||||
|
const error = {
|
||||||
|
id: field.id,
|
||||||
|
message: `Please check your ${field.id}`,
|
||||||
|
};
|
||||||
|
|
||||||
|
errors.push(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return errors;
|
||||||
|
};
|
@@ -2,5 +2,8 @@
|
|||||||
|
|
||||||
- single file contains single function only
|
- single file contains single function only
|
||||||
- please refer to the `tsx` files already exist in this directory for
|
- please refer to the `tsx` files already exist in this directory for
|
||||||
|
|
||||||
- styling
|
- styling
|
||||||
- naming convention
|
- naming convention
|
||||||
|
|
||||||
|
- `useListQuizListeningPracticeContent.tsx` is a sample for listing question in listening practice.
|
||||||
|
30
002_source/ionic_mobile/src/hooks/fetchCRQuestions.tsx
Normal file
30
002_source/ionic_mobile/src/hooks/fetchCRQuestions.tsx
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import { idCard } from 'ionicons/icons';
|
||||||
|
import { QuizCRQuestion } from '../types/QuizCRQuestion';
|
||||||
|
import { usePocketBase } from './usePocketBase';
|
||||||
|
import { QueryClient } from '@tanstack/react-query';
|
||||||
|
import PocketBase from 'pocketbase';
|
||||||
|
|
||||||
|
const queryClient = new QueryClient({
|
||||||
|
defaultOptions: {
|
||||||
|
queries: {
|
||||||
|
staleTime: Infinity,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const fetchCRQuestions = async (cat_id: string, pb: PocketBase) => {
|
||||||
|
const response = await queryClient.fetchQuery({
|
||||||
|
queryKey: ['fetchData', cat_id],
|
||||||
|
staleTime: 60 * 1000,
|
||||||
|
queryFn: async () => {
|
||||||
|
return await pb.collection('QuizCRQuestions').getList<QuizCRQuestion>(1, 9999, {
|
||||||
|
filter: `cat_id = "${cat_id}"`,
|
||||||
|
$autoCancel: false,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return response;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default fetchCRQuestions;
|
@@ -0,0 +1,38 @@
|
|||||||
|
// CR = ConnectiveRevision
|
||||||
|
import { usePocketBase } from './usePocketBase.tsx';
|
||||||
|
import { useQuery } from '@tanstack/react-query';
|
||||||
|
import IListeningPracticeCategory from '../interfaces/IListeningPracticeCategory.tsx';
|
||||||
|
|
||||||
|
const useListQuizCRCategories = () => {
|
||||||
|
const { user, pb } = usePocketBase();
|
||||||
|
return useQuery({
|
||||||
|
queryKey: [
|
||||||
|
'useListQuizConnectiveRevisionContent',
|
||||||
|
'feeds',
|
||||||
|
'all',
|
||||||
|
user?.id || '',
|
||||||
|
//
|
||||||
|
],
|
||||||
|
staleTime: 60 * 1000,
|
||||||
|
queryFn: async ({
|
||||||
|
queryKey,
|
||||||
|
}: {
|
||||||
|
queryKey: [
|
||||||
|
'useListQuizConnectiveRevisionContent',
|
||||||
|
'feeds',
|
||||||
|
'all',
|
||||||
|
string | null,
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}) => {
|
||||||
|
console.log('calling useListQuizConnectiveRevisionContent');
|
||||||
|
return await pb.collection('LessonsCategories').getList<IListeningPracticeCategory>(1, 9999, {
|
||||||
|
sort: 'pos',
|
||||||
|
$autoCancel: false,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// enabled: !!user?.id,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export default useListQuizCRCategories;
|
@@ -0,0 +1,26 @@
|
|||||||
|
import { usePocketBase } from './usePocketBase.tsx';
|
||||||
|
import { useQuery } from '@tanstack/react-query';
|
||||||
|
import { QuizCRQuestion } from '../types/QuizCRQuestion.ts/index.ts';
|
||||||
|
|
||||||
|
const useListQuizCRQuestionByCRCategoryId = (CRCategoryId: string) => {
|
||||||
|
const { user, pb } = usePocketBase();
|
||||||
|
return useQuery({
|
||||||
|
queryKey: ['useListQuizCRQuestionByCRCategoryId', 'feeds', 'all', user?.id || '', CRCategoryId],
|
||||||
|
staleTime: 60 * 1000,
|
||||||
|
queryFn: async ({
|
||||||
|
queryKey,
|
||||||
|
}: {
|
||||||
|
queryKey: ['useListQuizCRQuestionByCRCategoryId', 'feeds', 'all', string | null, string];
|
||||||
|
}) => {
|
||||||
|
console.log('calling useListQuizCRQuestionByCRCategoryId');
|
||||||
|
return await pb.collection('QuizCRQuestions').getList<QuizCRQuestion>(1, 9999, {
|
||||||
|
filter: `cat_id = "${CRCategoryId}"`,
|
||||||
|
sort: 'id',
|
||||||
|
$autoCancel: false,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// enabled: !!user?.id && !!CRCategoryId,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export default useListQuizCRQuestionByCRCategoryId;
|
@@ -5,7 +5,9 @@ interface IConnectivesRevisionCategory {
|
|||||||
test_i: number;
|
test_i: number;
|
||||||
cat_info: string;
|
cat_info: string;
|
||||||
cat_name: string;
|
cat_name: string;
|
||||||
content: IConnectivesRevisionQuestion[] | [];
|
content?: IConnectivesRevisionQuestion[] | [];
|
||||||
|
//
|
||||||
|
id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default IConnectivesRevisionCategory;
|
export default IConnectivesRevisionCategory;
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
// abonded
|
||||||
interface IQuestionMeta {
|
interface IQuestionMeta {
|
||||||
question_idx: number;
|
question_idx: number;
|
||||||
question_fh: string;
|
question_fh: string;
|
||||||
|
@@ -155,7 +155,7 @@ const QuizContent: React.FC<IQuestionCard> = ({
|
|||||||
>
|
>
|
||||||
{answer_list.map((connective, idx) => {
|
{answer_list.map((connective, idx) => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div key={idx}>
|
||||||
<IonButton
|
<IonButton
|
||||||
color={'dark'}
|
color={'dark'}
|
||||||
ref={button_refs[idx]}
|
ref={button_refs[idx]}
|
||||||
|
@@ -8,11 +8,15 @@ import { useMyIonQuizContext } from '../../contexts/MyIonQuiz';
|
|||||||
import { listConectivesRevisionContent } from '../../public_data/listConectivesRevisionContent';
|
import { listConectivesRevisionContent } from '../../public_data/listConectivesRevisionContent';
|
||||||
import { shuffleArray } from '../../utils/shuffleArray';
|
import { shuffleArray } from '../../utils/shuffleArray';
|
||||||
import QuizContent from './QuizContent';
|
import QuizContent from './QuizContent';
|
||||||
|
import fetchCRQuestions from '../../hooks/fetchCRQuestions';
|
||||||
|
import { usePocketBase } from '../../hooks/usePocketBase';
|
||||||
|
|
||||||
function ConnectiveRevisionQuizRun() {
|
function ConnectiveRevisionQuizRun() {
|
||||||
const router = useIonRouter();
|
const router = useIonRouter();
|
||||||
const { p_route } = useParams<{ p_route: string }>();
|
const { p_route: cat_id } = useParams<{ p_route: string }>();
|
||||||
const i_p_route = parseInt(p_route);
|
|
||||||
|
// NOTE: abonded, should be updated with `i_cat_id` when done
|
||||||
|
const i_p_route = parseInt(cat_id);
|
||||||
|
|
||||||
const { setTabActive } = useAppStateContext();
|
const { setTabActive } = useAppStateContext();
|
||||||
const [question_list, setQuestionList] = useState<IQuestionJson[] | []>([]);
|
const [question_list, setQuestionList] = useState<IQuestionJson[] | []>([]);
|
||||||
@@ -22,6 +26,9 @@ function ConnectiveRevisionQuizRun() {
|
|||||||
const [isOpenCorrectAnswer, setIsOpenCorrectAnswer] = useState(false);
|
const [isOpenCorrectAnswer, setIsOpenCorrectAnswer] = useState(false);
|
||||||
const [isOpenWrongAnswer, setIsOpenWrongAnswer] = useState(false);
|
const [isOpenWrongAnswer, setIsOpenWrongAnswer] = useState(false);
|
||||||
const [answer_list, setAnswerList] = useState<string[]>(['but', 'and', 'or', 'of', 'with']);
|
const [answer_list, setAnswerList] = useState<string[]>(['but', 'and', 'or', 'of', 'with']);
|
||||||
|
|
||||||
|
const { user, pb } = usePocketBase();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
setConnectiveRevisionCurrentTest,
|
setConnectiveRevisionCurrentTest,
|
||||||
setConnectiveRevisionProgress,
|
setConnectiveRevisionProgress,
|
||||||
@@ -79,19 +86,19 @@ function ConnectiveRevisionQuizRun() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
(async () => {
|
(async () => {
|
||||||
const res_json = await listConectivesRevisionContent();
|
const res_json = await fetchCRQuestions(cat_id, pb);
|
||||||
let temp_init_ans = res_json[i_p_route].init_ans;
|
let temp_init_ans: string[] = res_json.items[0].init_answer;
|
||||||
|
|
||||||
setInitAnswer(temp_init_ans);
|
setInitAnswer(temp_init_ans);
|
||||||
let temp = res_json[i_p_route].content;
|
let temp = res_json.items;
|
||||||
let shuffled_temp = shuffleArray(temp);
|
let shuffled_temp = shuffleArray(temp);
|
||||||
// let shuffled_temp = temp;
|
// let shuffled_temp = temp;
|
||||||
setQuestionList(shuffled_temp);
|
setQuestionList(shuffled_temp);
|
||||||
|
|
||||||
let question_meta_current = res_json[i_p_route].content[0];
|
let question_meta_current = res_json.items[0] as unknown as IQuestionMeta;
|
||||||
setCurrentQuestionMeta({
|
setCurrentQuestionMeta({
|
||||||
question_idx: current_question_idx,
|
|
||||||
...question_meta_current,
|
...question_meta_current,
|
||||||
|
question_idx: current_question_idx,
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
setTabActive(QUIZ_MAIN_MENU_LINK);
|
setTabActive(QUIZ_MAIN_MENU_LINK);
|
||||||
@@ -113,31 +120,7 @@ function ConnectiveRevisionQuizRun() {
|
|||||||
total_questions_num={question_list.length}
|
total_questions_num={question_list.length}
|
||||||
answer_list={answer_list}
|
answer_list={answer_list}
|
||||||
quiz_idx={i_p_route + 1}
|
quiz_idx={i_p_route + 1}
|
||||||
//
|
|
||||||
/>
|
/>
|
||||||
{/* */}
|
|
||||||
{/* <CorrectAnswerToast isOpen={isOpenCorrectAnswer} dismiss={() => setIsOpenCorrectAnswer(false)} /> */}
|
|
||||||
{/* */}
|
|
||||||
{/* <WrongAnswerToast
|
|
||||||
correct_answer={current_question_meta.modal_ans}
|
|
||||||
isOpen={isOpenWrongAnswer}
|
|
||||||
dismiss={() => setIsOpenWrongAnswer(false)}
|
|
||||||
/> */}
|
|
||||||
{/*
|
|
||||||
<IonToast
|
|
||||||
isOpen={isOpenCorrectAnswer}
|
|
||||||
message='This answer is correct'
|
|
||||||
onDidDismiss={() => setIsOpenCorrectAnswer(false)}
|
|
||||||
duration={1000 - 100}
|
|
||||||
color='success'
|
|
||||||
></IonToast>
|
|
||||||
<IonToast
|
|
||||||
isOpen={isOpenWrongAnswer}
|
|
||||||
message='This answer is wrong'
|
|
||||||
onDidDismiss={() => setIsOpenWrongAnswer(false)}
|
|
||||||
duration={1000 - 100}
|
|
||||||
color='danger'
|
|
||||||
></IonToast> */}
|
|
||||||
</IonContent>
|
</IonContent>
|
||||||
</IonPage>
|
</IonPage>
|
||||||
</>
|
</>
|
||||||
|
@@ -8,6 +8,7 @@ import { ConnectiveRevisionAllResult } from '../../contexts/ConnectiveRevisionRa
|
|||||||
import { useMyIonQuizContext } from '../../contexts/MyIonQuiz';
|
import { useMyIonQuizContext } from '../../contexts/MyIonQuiz';
|
||||||
import IConnectivesRevisionCategory from '../../interfaces/IConnectivesRevisionCategory';
|
import IConnectivesRevisionCategory from '../../interfaces/IConnectivesRevisionCategory';
|
||||||
import { listConectivesRevisionContent } from '../../public_data/listConectivesRevisionContent';
|
import { listConectivesRevisionContent } from '../../public_data/listConectivesRevisionContent';
|
||||||
|
import useListQuizCRCategories from '../../hooks/useListQuizCRCategories';
|
||||||
|
|
||||||
function ConnectiveRevisionSelectCategory() {
|
function ConnectiveRevisionSelectCategory() {
|
||||||
const PAGE_TITLE = 'Connective Revision';
|
const PAGE_TITLE = 'Connective Revision';
|
||||||
@@ -17,12 +18,12 @@ function ConnectiveRevisionSelectCategory() {
|
|||||||
let [categories, setCategories] = useState<IConnectivesRevisionCategory[] | []>([]);
|
let [categories, setCategories] = useState<IConnectivesRevisionCategory[] | []>([]);
|
||||||
let { setTabActive, setConnectiveRevisionInProgress } = useAppStateContext();
|
let { setTabActive, setConnectiveRevisionInProgress } = useAppStateContext();
|
||||||
|
|
||||||
useEffect(() => {
|
// useEffect(() => {
|
||||||
listConectivesRevisionContent().then((res_json) => {
|
// listConectivesRevisionContent().then((res_json) => {
|
||||||
setCategories(res_json);
|
// setCategories(res_json);
|
||||||
setLoading(false);
|
// setLoading(false);
|
||||||
});
|
// });
|
||||||
}, []);
|
// }, []);
|
||||||
|
|
||||||
let { loadConnectiveRevisionScoreBoard } = useMyIonQuizContext();
|
let { loadConnectiveRevisionScoreBoard } = useMyIonQuizContext();
|
||||||
let [scoreboard_meta, setScoreboardMeta] = useState<ConnectiveRevisionAllResult>();
|
let [scoreboard_meta, setScoreboardMeta] = useState<ConnectiveRevisionAllResult>();
|
||||||
@@ -36,6 +37,14 @@ function ConnectiveRevisionSelectCategory() {
|
|||||||
setTabActive(QUIZ_MAIN_MENU_LINK);
|
setTabActive(QUIZ_MAIN_MENU_LINK);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
let result = useListQuizCRCategories();
|
||||||
|
useEffect(() => {
|
||||||
|
if (result.status === 'success') {
|
||||||
|
setCategories(result.data.items);
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
}, [result]);
|
||||||
|
|
||||||
if (loading) return <LoadingScreen />;
|
if (loading) return <LoadingScreen />;
|
||||||
if (!scoreboard_meta) return <LoadingScreen />;
|
if (!scoreboard_meta) return <LoadingScreen />;
|
||||||
|
|
||||||
@@ -87,36 +96,34 @@ function ConnectiveRevisionSelectCategory() {
|
|||||||
</div>
|
</div>
|
||||||
<div>{'Question Bank'}</div>
|
<div>{'Question Bank'}</div>
|
||||||
<div style={{ width: '80vw' }}>
|
<div style={{ width: '80vw' }}>
|
||||||
{categories
|
{categories.map((item, idx) => (
|
||||||
.map((item) => item.cat_name)
|
<div style={{ margin: '0.9rem 0 0.9rem' }} key={idx}>
|
||||||
.map((item_name, idx) => (
|
<IonButton
|
||||||
<div style={{ margin: '0.9rem 0 0.9rem' }} key={idx}>
|
color="dark"
|
||||||
<IonButton
|
fill="outline"
|
||||||
color="dark"
|
expand="block"
|
||||||
fill="outline"
|
onClick={() => {
|
||||||
expand="block"
|
setConnectiveRevisionInProgress(true);
|
||||||
onClick={() => {
|
router.push(`${CONNECTIVE_REVISION_LINK}/r/${item.id}`, 'none', 'replace');
|
||||||
setConnectiveRevisionInProgress(true);
|
}}
|
||||||
router.push(`${CONNECTIVE_REVISION_LINK}/r/${idx}`, 'none', 'replace');
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
width: '100%',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<div>{item.cat_name}</div>
|
||||||
style={{
|
<div>
|
||||||
display: 'flex',
|
{scoreboard_meta[idx.toString()] || 0}
|
||||||
flexDirection: 'row',
|
{'%'}
|
||||||
justifyContent: 'space-between',
|
|
||||||
width: '100%',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div>{item_name}</div>
|
|
||||||
<div>
|
|
||||||
{scoreboard_meta[idx.toString()] || 0}
|
|
||||||
{'%'}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</IonButton>
|
</div>
|
||||||
</div>
|
</IonButton>
|
||||||
))}
|
</div>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</IonContent>
|
</IonContent>
|
||||||
|
56
002_source/ionic_mobile/src/pages/auth/Home/index.tsx
Normal file
56
002_source/ionic_mobile/src/pages/auth/Home/index.tsx
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
import {
|
||||||
|
IonButton,
|
||||||
|
IonCardTitle,
|
||||||
|
IonCol,
|
||||||
|
IonContent,
|
||||||
|
IonFooter,
|
||||||
|
IonGrid,
|
||||||
|
IonHeader,
|
||||||
|
IonImg,
|
||||||
|
IonPage,
|
||||||
|
IonRouterLink,
|
||||||
|
IonRow,
|
||||||
|
IonToolbar,
|
||||||
|
} from '@ionic/react';
|
||||||
|
// import { Action } from '../components/Action';
|
||||||
|
import styles from './style.module.scss';
|
||||||
|
import { Action } from '../../../components/Action';
|
||||||
|
|
||||||
|
const AuthHome = () => {
|
||||||
|
return (
|
||||||
|
<IonPage className={'styles.homePage'}>
|
||||||
|
<IonHeader>
|
||||||
|
{/* <IonToolbar className="ion-no-margin ion-no-padding"> */}
|
||||||
|
<IonImg src="/assets/login2.jpeg" />
|
||||||
|
{/* </IonToolbar> */}
|
||||||
|
</IonHeader>
|
||||||
|
<IonContent fullscreen>
|
||||||
|
<div className={styles.getStarted}>
|
||||||
|
<IonGrid>
|
||||||
|
<IonRow className={`ion-text-center ion-justify-content-center ${styles.heading}`}>
|
||||||
|
<IonCol size="11" className={styles.headingText}>
|
||||||
|
<IonCardTitle>Join millions of other people discovering their creative side</IonCardTitle>
|
||||||
|
</IonCol>
|
||||||
|
</IonRow>
|
||||||
|
|
||||||
|
<IonRow className={`ion-text-center ion-justify-content-center`}>
|
||||||
|
<IonRouterLink routerLink="/signup" className="custom-link">
|
||||||
|
<IonCol size="11">
|
||||||
|
<IonButton className={`${styles.getStartedButton} custom-button`}>Get started →</IonButton>
|
||||||
|
</IonCol>
|
||||||
|
</IonRouterLink>
|
||||||
|
</IonRow>
|
||||||
|
</IonGrid>
|
||||||
|
</div>
|
||||||
|
</IonContent>
|
||||||
|
|
||||||
|
<IonFooter>
|
||||||
|
<IonGrid>
|
||||||
|
<Action message="Already got an account?" text="Login" link="/login" />
|
||||||
|
</IonGrid>
|
||||||
|
</IonFooter>
|
||||||
|
</IonPage>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AuthHome;
|
@@ -0,0 +1,41 @@
|
|||||||
|
.homePage {
|
||||||
|
ion-header {
|
||||||
|
ion-img {
|
||||||
|
border-bottom: 3px solid rgb(236, 149, 35);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ion-footer {
|
||||||
|
// background-color: #7c3b6a;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.getStarted {
|
||||||
|
height: 100%;
|
||||||
|
background-color: #ffffff;
|
||||||
|
background-image: radial-gradient(#b8b8b8 1px, transparent 1px), radial-gradient(#b8b8b8 1px, #ffffff 1px);
|
||||||
|
background-size: 40px 40px;
|
||||||
|
background-position:
|
||||||
|
0 0,
|
||||||
|
20px 20px;
|
||||||
|
|
||||||
|
ion-card-title {
|
||||||
|
color: black !important;
|
||||||
|
letter-spacing: -0.08rem;
|
||||||
|
font-weight: 900 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.heading {
|
||||||
|
margin-top: 7rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.getStartedButton {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.helloworld {
|
||||||
|
color: gold;
|
||||||
|
}
|
93
002_source/ionic_mobile/src/pages/auth/Login/index.tsx
Normal file
93
002_source/ionic_mobile/src/pages/auth/Login/index.tsx
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
import {
|
||||||
|
IonBackButton,
|
||||||
|
IonButton,
|
||||||
|
IonButtons,
|
||||||
|
IonCardTitle,
|
||||||
|
IonCol,
|
||||||
|
IonContent,
|
||||||
|
IonFooter,
|
||||||
|
IonGrid,
|
||||||
|
IonHeader,
|
||||||
|
IonIcon,
|
||||||
|
IonImg,
|
||||||
|
IonInput,
|
||||||
|
IonInputPasswordToggle,
|
||||||
|
IonPage,
|
||||||
|
IonRouterLink,
|
||||||
|
IonRow,
|
||||||
|
IonText,
|
||||||
|
IonToolbar,
|
||||||
|
} from '@ionic/react';
|
||||||
|
import styles from './style.module.scss';
|
||||||
|
|
||||||
|
import { arrowBack, shapesOutline } from 'ionicons/icons';
|
||||||
|
import { CustomField } from '../../../components/CustomField';
|
||||||
|
import { useLoginFields } from '../../../data/fields';
|
||||||
|
|
||||||
|
import { Action } from '../../../components/Action';
|
||||||
|
import { Wave } from '../../../components/Wave';
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
|
import { useParams } from 'react-router';
|
||||||
|
|
||||||
|
function AuthLogin(): React.JSX.Element {
|
||||||
|
const params = useParams();
|
||||||
|
const [errors, setErrors] = useState(false);
|
||||||
|
|
||||||
|
const login = () => {};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<IonPage className={styles.loginPage}>
|
||||||
|
<IonHeader>
|
||||||
|
<IonToolbar>
|
||||||
|
<IonButtons slot="start">
|
||||||
|
<IonBackButton icon={arrowBack} text="" className="custom-back" />
|
||||||
|
</IonButtons>
|
||||||
|
|
||||||
|
<IonButtons slot="end">
|
||||||
|
<IonButton className="custom-button">
|
||||||
|
<IonIcon icon={shapesOutline} />
|
||||||
|
</IonButton>
|
||||||
|
</IonButtons>
|
||||||
|
</IonToolbar>
|
||||||
|
</IonHeader>
|
||||||
|
{/* */}
|
||||||
|
<IonContent fullscreen>
|
||||||
|
<IonGrid className="ion-padding">
|
||||||
|
<IonRow>
|
||||||
|
<IonCol size="12" className={styles.headingText}>
|
||||||
|
<IonCardTitle>Log in</IonCardTitle>
|
||||||
|
<h5>Welcome back, hope you're doing well</h5>
|
||||||
|
</IonCol>
|
||||||
|
</IonRow>
|
||||||
|
|
||||||
|
<IonRow className="ion-margin-top ion-padding-top">
|
||||||
|
<IonCol size="12">
|
||||||
|
<IonInput labelPlacement="floating" value="hi@ionic.io">
|
||||||
|
<div slot="label">
|
||||||
|
Email <IonText color="danger">(Required)</IonText>
|
||||||
|
</div>
|
||||||
|
</IonInput>
|
||||||
|
<IonInput type="password" label="Password" value="NeverGonnaGiveYouUp">
|
||||||
|
<IonInputPasswordToggle slot="end"></IonInputPasswordToggle>
|
||||||
|
</IonInput>
|
||||||
|
|
||||||
|
<IonButton className="custom-button" expand="block" onClick={login}>
|
||||||
|
Login
|
||||||
|
</IonButton>
|
||||||
|
</IonCol>
|
||||||
|
</IonRow>
|
||||||
|
</IonGrid>
|
||||||
|
</IonContent>
|
||||||
|
{/* */}
|
||||||
|
<IonFooter>
|
||||||
|
<IonGrid className="ion-no-margin ion-no-padding">
|
||||||
|
<Action message="Don't have an account?" text="Sign up" link="/auth/signup" />
|
||||||
|
<Wave />
|
||||||
|
</IonGrid>
|
||||||
|
</IonFooter>
|
||||||
|
</IonPage>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { AuthLogin };
|
@@ -0,0 +1,17 @@
|
|||||||
|
.loginPage {
|
||||||
|
ion-toolbar {
|
||||||
|
--border-style: none;
|
||||||
|
--border-color: transparent;
|
||||||
|
--padding-top: 1rem;
|
||||||
|
--padding-bottom: 1rem;
|
||||||
|
--padding-start: 1rem;
|
||||||
|
--padding-end: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.headingText {
|
||||||
|
h5 {
|
||||||
|
margin-top: 0.2rem;
|
||||||
|
// color: #d3a6c7;
|
||||||
|
}
|
||||||
|
}
|
95
002_source/ionic_mobile/src/pages/auth/SignUp/index.tsx
Normal file
95
002_source/ionic_mobile/src/pages/auth/SignUp/index.tsx
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
import {
|
||||||
|
IonBackButton,
|
||||||
|
IonButton,
|
||||||
|
IonButtons,
|
||||||
|
IonCardTitle,
|
||||||
|
IonCol,
|
||||||
|
IonContent,
|
||||||
|
IonFooter,
|
||||||
|
IonGrid,
|
||||||
|
IonHeader,
|
||||||
|
IonIcon,
|
||||||
|
IonImg,
|
||||||
|
IonInput,
|
||||||
|
IonInputPasswordToggle,
|
||||||
|
IonPage,
|
||||||
|
IonRouterLink,
|
||||||
|
IonRow,
|
||||||
|
IonText,
|
||||||
|
IonToolbar,
|
||||||
|
} from '@ionic/react';
|
||||||
|
import styles from './style.module.scss';
|
||||||
|
|
||||||
|
import { arrowBack, shapesOutline } from 'ionicons/icons';
|
||||||
|
import { CustomField } from '../../../components/CustomField';
|
||||||
|
import { useLoginFields, useSignupFields } from '../../../data/fields';
|
||||||
|
|
||||||
|
import { Action } from '../../../components/Action';
|
||||||
|
import { Wave } from '../../../components/Wave';
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
|
import { useParams } from 'react-router';
|
||||||
|
|
||||||
|
function AuthSignUp(): React.JSX.Element {
|
||||||
|
const params = useParams();
|
||||||
|
const fields = useSignupFields();
|
||||||
|
const [errors, setErrors] = useState(false);
|
||||||
|
|
||||||
|
const login = () => {};
|
||||||
|
|
||||||
|
function createAccount() {}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<IonPage className={styles.loginPage}>
|
||||||
|
<IonHeader>
|
||||||
|
<IonToolbar>
|
||||||
|
<IonButtons slot="start">
|
||||||
|
<IonBackButton icon={arrowBack} text="" className="custom-back" />
|
||||||
|
</IonButtons>
|
||||||
|
|
||||||
|
<IonButtons slot="end">
|
||||||
|
<IonButton className="custom-button">
|
||||||
|
<IonIcon icon={shapesOutline} />
|
||||||
|
</IonButton>
|
||||||
|
</IonButtons>
|
||||||
|
</IonToolbar>
|
||||||
|
</IonHeader>
|
||||||
|
{/* */}
|
||||||
|
<IonContent fullscreen>
|
||||||
|
<IonGrid className="ion-padding">
|
||||||
|
<IonRow>
|
||||||
|
<IonCol size="12" className={styles.headingText}>
|
||||||
|
<IonCardTitle>Sign up</IonCardTitle>
|
||||||
|
<h5>Lets get to know each other</h5>
|
||||||
|
</IonCol>
|
||||||
|
</IonRow>
|
||||||
|
|
||||||
|
<IonRow className="ion-margin-top ion-padding-top">
|
||||||
|
<IonCol size="12">
|
||||||
|
{fields.map((field, i) => {
|
||||||
|
return (
|
||||||
|
<div key={i}>
|
||||||
|
<CustomField field={field} errors={errors} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
|
||||||
|
<IonButton className="custom-button" expand="block" onClick={createAccount}>
|
||||||
|
Create account
|
||||||
|
</IonButton>
|
||||||
|
</IonCol>
|
||||||
|
</IonRow>
|
||||||
|
</IonGrid>
|
||||||
|
</IonContent>
|
||||||
|
{/* */}
|
||||||
|
<IonFooter>
|
||||||
|
<IonGrid className="ion-no-margin ion-no-padding">
|
||||||
|
<Action message="Already got an account?" text="Login" link="/auth/login" />
|
||||||
|
<Wave />
|
||||||
|
</IonGrid>
|
||||||
|
</IonFooter>
|
||||||
|
</IonPage>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { AuthSignUp };
|
@@ -0,0 +1,17 @@
|
|||||||
|
.signupPage {
|
||||||
|
ion-toolbar {
|
||||||
|
--border-style: none;
|
||||||
|
--border-color: transparent;
|
||||||
|
--padding-top: 1rem;
|
||||||
|
--padding-bottom: 1rem;
|
||||||
|
--padding-start: 1rem;
|
||||||
|
--padding-end: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.headingText {
|
||||||
|
h5 {
|
||||||
|
margin-top: 0.2rem;
|
||||||
|
// color: #d3a6c7;
|
||||||
|
}
|
||||||
|
}
|
33
002_source/ionic_mobile/src/types/QuizCRQuestion.ts
Normal file
33
002_source/ionic_mobile/src/types/QuizCRQuestion.ts
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/**
|
||||||
|
* Represents a Connectives Revision Quiz Question
|
||||||
|
*/
|
||||||
|
export interface QuizCRQuestion {
|
||||||
|
/** Unique identifier */
|
||||||
|
id: string;
|
||||||
|
/** Creation timestamp */
|
||||||
|
created: Date;
|
||||||
|
/** Last update timestamp */
|
||||||
|
updated: Date;
|
||||||
|
/** First half of the question */
|
||||||
|
question_fh: string;
|
||||||
|
/** Second half of the question */
|
||||||
|
question_sh: string;
|
||||||
|
/** Modal answer text */
|
||||||
|
modal_ans: string;
|
||||||
|
/** Initial answer text */
|
||||||
|
init_answer: string[];
|
||||||
|
/** Category ID reference */
|
||||||
|
cat_id: string;
|
||||||
|
/** Additional options in JSON format */
|
||||||
|
options: Record<string, unknown>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expanded QuizCRQuestion with related category data
|
||||||
|
*/
|
||||||
|
export interface QuizCRQuestionExpanded extends QuizCRQuestion {
|
||||||
|
/** Category name */
|
||||||
|
cat_name?: string;
|
||||||
|
/** Category image */
|
||||||
|
cat_image?: string;
|
||||||
|
}
|
@@ -1,3 +1,7 @@
|
|||||||
# GUIDELINES
|
# GUIDELINES
|
||||||
|
|
||||||
- please follow to the `schema.dbml` when you draft types related to db
|
- please follow to the `schema.dbml` when you draft types related to db
|
||||||
|
|
||||||
|
## highlighted samples
|
||||||
|
|
||||||
|
- `QuizLPQuestion.d.ts`
|
||||||
|
@@ -2,11 +2,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ESNext",
|
"target": "ESNext",
|
||||||
"useDefineForClassFields": true,
|
"useDefineForClassFields": true,
|
||||||
"lib": [
|
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
||||||
"DOM",
|
|
||||||
"DOM.Iterable",
|
|
||||||
"ESNext"
|
|
||||||
],
|
|
||||||
"allowJs": false,
|
"allowJs": false,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"esModuleInterop": false,
|
"esModuleInterop": false,
|
||||||
@@ -20,17 +16,16 @@
|
|||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"jsx": "react-jsx"
|
"jsx": "react-jsx"
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["src"],
|
||||||
"src"
|
|
||||||
],
|
|
||||||
"exclude": [
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"./dist",
|
||||||
|
//
|
||||||
"**/*.del",
|
"**/*.del",
|
||||||
"**/*copy.*",
|
"**/*copy.*",
|
||||||
"**/*copy*.*",
|
"**/*copy*.*",
|
||||||
"**/*.bak",
|
"**/*.bak",
|
||||||
"**/*.fix",
|
"**/*.fix"
|
||||||
"node_modules",
|
|
||||||
"./dist"
|
|
||||||
],
|
],
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
|
1
002_source/pocketbase/.gitignore
vendored
1
002_source/pocketbase/.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
#
|
#
|
||||||
volumes
|
volumes
|
||||||
|
pb_migrations
|
||||||
|
23315
002_source/pocketbase/pb_data/types.d.ts
vendored
23315
002_source/pocketbase/pb_data/types.d.ts
vendored
File diff suppressed because it is too large
Load Diff
1
002_source/pocketbase/pb_hooks/seed/.gitignore
vendored
Normal file
1
002_source/pocketbase/pb_hooks/seed/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
_archive
|
@@ -2,9 +2,9 @@ const config = require("/pb_hooks/seed/config.js");
|
|||||||
const utils = require("/pb_hooks/seed/utils.js");
|
const utils = require("/pb_hooks/seed/utils.js");
|
||||||
|
|
||||||
module.exports = ($app) => {
|
module.exports = ($app) => {
|
||||||
const { CR_cat_id_news, CR_cat_id_technology } = config;
|
const { CR_cat_id_news, CR_cat_id_technology, user_id_admin } = config;
|
||||||
const { getId, getAsset } = utils;
|
const { getId, getAsset } = utils;
|
||||||
const ADMIN_USER_ID = getId("999");
|
const ADMIN_USER_ID = user_id_admin;
|
||||||
|
|
||||||
let row_array = [[ADMIN_USER_ID, "admin@123.com", "admin@123.com", "admin@123.com", true, true, "test_admin_1"]];
|
let row_array = [[ADMIN_USER_ID, "admin@123.com", "admin@123.com", "admin@123.com", true, true, "test_admin_1"]];
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@ const config = require("/pb_hooks/seed/config.js");
|
|||||||
const utils = require("/pb_hooks/seed/utils.js");
|
const utils = require("/pb_hooks/seed/utils.js");
|
||||||
//
|
//
|
||||||
module.exports = ($app) => {
|
module.exports = ($app) => {
|
||||||
const { CR_cat_id_news, CR_cat_id_technology } = config;
|
const { CR_cat_id_news, CR_cat_id_technology, user_id_admin, user_id_test_teacher_1 } = config;
|
||||||
const { getId, getAsset, dirtyTruncateTable } = utils;
|
const { getId, getAsset, dirtyTruncateTable } = utils;
|
||||||
|
|
||||||
// const ASSETS_DIR = "/pb_hooks/assets";
|
// const ASSETS_DIR = "/pb_hooks/assets";
|
||||||
@@ -15,29 +15,34 @@ module.exports = ($app) => {
|
|||||||
// const getId = (id) => id.padStart(15, 0);
|
// const getId = (id) => id.padStart(15, 0);
|
||||||
|
|
||||||
// generate from `./project/001_documentation/Requirements/REQ0006/gen_customer/gen_customer.mjs`
|
// generate from `./project/001_documentation/Requirements/REQ0006/gen_customer/gen_customer.mjs`
|
||||||
const SAMPLE_CUSTOMER_ARRAY = [
|
const SAMPLE_NOTI_ARRAY = [
|
||||||
[getId("1"), "EV-004", false, "new_job", { id: getId("1"), name: "Jie Yan", avatar: "/assets/avatar-8.png" }, { title: "Remote React / React Native Developer" }, ""],
|
[getId("1"), "EV-004", "2025-05-01", false, "new_job", user_id_admin, { title: "Remote React / React Native Developer" }, "", {}, user_id_admin, "https://www.google.com"],
|
||||||
[getId("2"), "EV-003", true, "new_job", { id: getId("2"), name: "Fran Perez", avatar: "/assets/avatar-5.png" }, { title: "Senior Golang Backend Engineer" }, ""],
|
[getId("2"), "EV-003", "2025-05-01", false, "new_job", user_id_admin, { title: "Senior Golang Backend Engineer" }, "", {}, user_id_admin, "https://www.google.com"],
|
||||||
[getId("3"), "EV-002", true, "new_feature", "", "", "Logistics management is now available"],
|
[getId("3"), "EV-002", "2025-05-01", false, "new_feature", user_id_admin, {}, "Logistics management is now available", {}, user_id_admin, "https://www.google.com"],
|
||||||
[getId("4"), "EV-001", true, "new_company", { id: getId("3"), name: "Jie Yan", avatar: "/assets/avatar-8.png" }, { name: "Stripe" }, ""],
|
[getId("4"), "EV-001", "2025-05-01", false, "new_company", user_id_admin, {}, "", { name: "Stripe" }, user_id_admin, "https://www.google.com"],
|
||||||
|
[getId("5"), "EV-005", "2025-05-01", false, "new_company", user_id_admin, {}, "", { name: "Stripe (without link test)" }, user_id_admin, null],
|
||||||
];
|
];
|
||||||
|
|
||||||
let row_array = SAMPLE_CUSTOMER_ARRAY;
|
let row_array = SAMPLE_NOTI_ARRAY;
|
||||||
dirtyTruncateTable("Notifications");
|
dirtyTruncateTable("Notifications");
|
||||||
|
|
||||||
let lt_collection = $app.findCollectionByNameOrId("Notifications");
|
let lt_collection = $app.findCollectionByNameOrId("Notifications");
|
||||||
|
|
||||||
for (let i = 0; i < row_array.length; i++) {
|
for (let i = 0; i < row_array.length; i++) {
|
||||||
let customer = row_array[i];
|
let noti = row_array[i];
|
||||||
|
|
||||||
let record = new Record(lt_collection);
|
let record = new Record(lt_collection);
|
||||||
record.set("id", customer[0]);
|
record.set("id", noti[0]);
|
||||||
record.set("NOTI_ID", customer[1]);
|
record.set("NOTI_ID", noti[1]);
|
||||||
record.set("read", customer[2]);
|
record.set("created_at", noti[2]);
|
||||||
record.set("type", customer[3]);
|
record.set("read", noti[3]);
|
||||||
record.set("author", customer[4]);
|
record.set("type", noti[4]);
|
||||||
record.set("job", customer[5]);
|
record.set("author", noti[5]);
|
||||||
record.set("description", customer[6]);
|
record.set("job", noti[6]);
|
||||||
|
record.set("description", noti[7]);
|
||||||
|
record.set("company", noti[8]);
|
||||||
|
record.set("to_user_id", noti[9]);
|
||||||
|
record.set("link", noti[10]);
|
||||||
|
|
||||||
$app.save(record);
|
$app.save(record);
|
||||||
}
|
}
|
||||||
|
@@ -24,4 +24,7 @@ module.exports = {
|
|||||||
CR_cat_id_news: "1".padStart(15, 0),
|
CR_cat_id_news: "1".padStart(15, 0),
|
||||||
CR_cat_id_sports: "2".padStart(15, 0),
|
CR_cat_id_sports: "2".padStart(15, 0),
|
||||||
CR_cat_id_technology: "3".padStart(15, 0),
|
CR_cat_id_technology: "3".padStart(15, 0),
|
||||||
|
//
|
||||||
|
user_id_admin: "999".padStart(15, 0),
|
||||||
|
user_id_test_teacher_1: "11".padStart(15, 0),
|
||||||
};
|
};
|
||||||
|
@@ -1057,16 +1057,6 @@
|
|||||||
"system": false,
|
"system": false,
|
||||||
"type": "text"
|
"type": "text"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"hidden": false,
|
|
||||||
"id": "json3182418120",
|
|
||||||
"maxSize": 0,
|
|
||||||
"name": "author",
|
|
||||||
"presentable": false,
|
|
||||||
"required": false,
|
|
||||||
"system": false,
|
|
||||||
"type": "json"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"hidden": false,
|
"hidden": false,
|
||||||
"id": "json4225294584",
|
"id": "json4225294584",
|
||||||
@@ -1124,6 +1114,77 @@
|
|||||||
"presentable": false,
|
"presentable": false,
|
||||||
"system": false,
|
"system": false,
|
||||||
"type": "autodate"
|
"type": "autodate"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cascadeDelete": false,
|
||||||
|
"collectionId": "pbc_1305841361",
|
||||||
|
"hidden": false,
|
||||||
|
"id": "relation704048736",
|
||||||
|
"maxSelect": 1,
|
||||||
|
"minSelect": 0,
|
||||||
|
"name": "to_user_id",
|
||||||
|
"presentable": false,
|
||||||
|
"required": false,
|
||||||
|
"system": false,
|
||||||
|
"type": "relation"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cascadeDelete": false,
|
||||||
|
"collectionId": "pbc_1305841361",
|
||||||
|
"hidden": false,
|
||||||
|
"id": "relation556806202",
|
||||||
|
"maxSelect": 1,
|
||||||
|
"minSelect": 0,
|
||||||
|
"name": "from_user_id",
|
||||||
|
"presentable": false,
|
||||||
|
"required": false,
|
||||||
|
"system": false,
|
||||||
|
"type": "relation"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cascadeDelete": false,
|
||||||
|
"collectionId": "pbc_1305841361",
|
||||||
|
"hidden": false,
|
||||||
|
"id": "relation3182418120",
|
||||||
|
"maxSelect": 1,
|
||||||
|
"minSelect": 0,
|
||||||
|
"name": "author",
|
||||||
|
"presentable": false,
|
||||||
|
"required": false,
|
||||||
|
"system": false,
|
||||||
|
"type": "relation"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"convertURLs": false,
|
||||||
|
"hidden": false,
|
||||||
|
"id": "editor4274335913",
|
||||||
|
"maxSize": 0,
|
||||||
|
"name": "content",
|
||||||
|
"presentable": false,
|
||||||
|
"required": false,
|
||||||
|
"system": false,
|
||||||
|
"type": "editor"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hidden": false,
|
||||||
|
"id": "json1337919823",
|
||||||
|
"maxSize": 0,
|
||||||
|
"name": "company",
|
||||||
|
"presentable": false,
|
||||||
|
"required": false,
|
||||||
|
"system": false,
|
||||||
|
"type": "json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"exceptDomains": null,
|
||||||
|
"hidden": false,
|
||||||
|
"id": "url917281265",
|
||||||
|
"name": "link",
|
||||||
|
"onlyDomains": null,
|
||||||
|
"presentable": false,
|
||||||
|
"required": false,
|
||||||
|
"system": false,
|
||||||
|
"type": "url"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"indexes": [],
|
"indexes": [],
|
||||||
|
@@ -1,136 +0,0 @@
|
|||||||
/// <reference path="../pb_data/types.d.ts" />
|
|
||||||
migrate((app) => {
|
|
||||||
const collection = app.findCollectionByNameOrId("pbc_1305841361");
|
|
||||||
|
|
||||||
return app.delete(collection);
|
|
||||||
}, (app) => {
|
|
||||||
const collection = new Collection({
|
|
||||||
"createRule": "",
|
|
||||||
"deleteRule": "",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"autogeneratePattern": "[a-z0-9]{15}",
|
|
||||||
"hidden": false,
|
|
||||||
"id": "text3208210256",
|
|
||||||
"max": 15,
|
|
||||||
"min": 15,
|
|
||||||
"name": "id",
|
|
||||||
"pattern": "^[a-z0-9]+$",
|
|
||||||
"presentable": false,
|
|
||||||
"primaryKey": true,
|
|
||||||
"required": true,
|
|
||||||
"system": true,
|
|
||||||
"type": "text"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"autogeneratePattern": "",
|
|
||||||
"hidden": false,
|
|
||||||
"id": "text4192936109",
|
|
||||||
"max": 0,
|
|
||||||
"min": 0,
|
|
||||||
"name": "helloworld",
|
|
||||||
"pattern": "",
|
|
||||||
"presentable": false,
|
|
||||||
"primaryKey": false,
|
|
||||||
"required": false,
|
|
||||||
"system": false,
|
|
||||||
"type": "text"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"hidden": false,
|
|
||||||
"id": "json3622966325",
|
|
||||||
"maxSize": 0,
|
|
||||||
"name": "meta",
|
|
||||||
"presentable": false,
|
|
||||||
"required": false,
|
|
||||||
"system": false,
|
|
||||||
"type": "json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cascadeDelete": false,
|
|
||||||
"collectionId": "_pb_users_auth_",
|
|
||||||
"hidden": false,
|
|
||||||
"id": "relation2809058197",
|
|
||||||
"maxSelect": 1,
|
|
||||||
"minSelect": 0,
|
|
||||||
"name": "user_id",
|
|
||||||
"presentable": false,
|
|
||||||
"required": false,
|
|
||||||
"system": false,
|
|
||||||
"type": "relation"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"hidden": false,
|
|
||||||
"id": "autodate2990389176",
|
|
||||||
"name": "created",
|
|
||||||
"onCreate": true,
|
|
||||||
"onUpdate": false,
|
|
||||||
"presentable": false,
|
|
||||||
"system": false,
|
|
||||||
"type": "autodate"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"hidden": false,
|
|
||||||
"id": "autodate3332085495",
|
|
||||||
"name": "updated",
|
|
||||||
"onCreate": true,
|
|
||||||
"onUpdate": true,
|
|
||||||
"presentable": false,
|
|
||||||
"system": false,
|
|
||||||
"type": "autodate"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"autogeneratePattern": "",
|
|
||||||
"hidden": false,
|
|
||||||
"id": "text2744374011",
|
|
||||||
"max": 0,
|
|
||||||
"min": 0,
|
|
||||||
"name": "state",
|
|
||||||
"pattern": "",
|
|
||||||
"presentable": false,
|
|
||||||
"primaryKey": false,
|
|
||||||
"required": false,
|
|
||||||
"system": false,
|
|
||||||
"type": "text"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"hidden": false,
|
|
||||||
"id": "file376926767",
|
|
||||||
"maxSelect": 1,
|
|
||||||
"maxSize": 0,
|
|
||||||
"mimeTypes": [],
|
|
||||||
"name": "avatar",
|
|
||||||
"presentable": false,
|
|
||||||
"protected": false,
|
|
||||||
"required": false,
|
|
||||||
"system": false,
|
|
||||||
"thumbs": [],
|
|
||||||
"type": "file"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"autogeneratePattern": "",
|
|
||||||
"hidden": false,
|
|
||||||
"id": "text1466534506",
|
|
||||||
"max": 0,
|
|
||||||
"min": 0,
|
|
||||||
"name": "role",
|
|
||||||
"pattern": "",
|
|
||||||
"presentable": false,
|
|
||||||
"primaryKey": false,
|
|
||||||
"required": false,
|
|
||||||
"system": false,
|
|
||||||
"type": "text"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"id": "pbc_1305841361",
|
|
||||||
"indexes": [],
|
|
||||||
"listRule": "",
|
|
||||||
"name": "UserMetas",
|
|
||||||
"system": false,
|
|
||||||
"type": "base",
|
|
||||||
"updateRule": "",
|
|
||||||
"viewRule": ""
|
|
||||||
});
|
|
||||||
|
|
||||||
return app.save(collection);
|
|
||||||
})
|
|
@@ -1,45 +0,0 @@
|
|||||||
/// <reference path="../pb_data/types.d.ts" />
|
|
||||||
migrate((app) => {
|
|
||||||
const collection = app.findCollectionByNameOrId("pbc_1305841361")
|
|
||||||
|
|
||||||
// add field
|
|
||||||
collection.fields.addAt(9, new Field({
|
|
||||||
"autogeneratePattern": "",
|
|
||||||
"hidden": false,
|
|
||||||
"id": "text1579384326",
|
|
||||||
"max": 0,
|
|
||||||
"min": 0,
|
|
||||||
"name": "name",
|
|
||||||
"pattern": "",
|
|
||||||
"presentable": false,
|
|
||||||
"primaryKey": false,
|
|
||||||
"required": false,
|
|
||||||
"system": false,
|
|
||||||
"type": "text"
|
|
||||||
}))
|
|
||||||
|
|
||||||
// add field
|
|
||||||
collection.fields.addAt(10, new Field({
|
|
||||||
"exceptDomains": null,
|
|
||||||
"hidden": false,
|
|
||||||
"id": "email3885137012",
|
|
||||||
"name": "email",
|
|
||||||
"onlyDomains": null,
|
|
||||||
"presentable": false,
|
|
||||||
"required": false,
|
|
||||||
"system": false,
|
|
||||||
"type": "email"
|
|
||||||
}))
|
|
||||||
|
|
||||||
return app.save(collection)
|
|
||||||
}, (app) => {
|
|
||||||
const collection = app.findCollectionByNameOrId("pbc_1305841361")
|
|
||||||
|
|
||||||
// remove field
|
|
||||||
collection.fields.removeById("text1579384326")
|
|
||||||
|
|
||||||
// remove field
|
|
||||||
collection.fields.removeById("email3885137012")
|
|
||||||
|
|
||||||
return app.save(collection)
|
|
||||||
})
|
|
@@ -1,29 +0,0 @@
|
|||||||
/// <reference path="../pb_data/types.d.ts" />
|
|
||||||
migrate((app) => {
|
|
||||||
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
|
|
||||||
|
|
||||||
// add field
|
|
||||||
collection.fields.addAt(11, new Field({
|
|
||||||
"autogeneratePattern": "",
|
|
||||||
"hidden": false,
|
|
||||||
"id": "text1146066909",
|
|
||||||
"max": 0,
|
|
||||||
"min": 0,
|
|
||||||
"name": "phone",
|
|
||||||
"pattern": "",
|
|
||||||
"presentable": false,
|
|
||||||
"primaryKey": false,
|
|
||||||
"required": false,
|
|
||||||
"system": false,
|
|
||||||
"type": "text"
|
|
||||||
}))
|
|
||||||
|
|
||||||
return app.save(collection)
|
|
||||||
}, (app) => {
|
|
||||||
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
|
|
||||||
|
|
||||||
// remove field
|
|
||||||
collection.fields.removeById("text1146066909")
|
|
||||||
|
|
||||||
return app.save(collection)
|
|
||||||
})
|
|
@@ -1,29 +0,0 @@
|
|||||||
/// <reference path="../pb_data/types.d.ts" />
|
|
||||||
migrate((app) => {
|
|
||||||
const collection = app.findCollectionByNameOrId("pbc_1305841361")
|
|
||||||
|
|
||||||
// add field
|
|
||||||
collection.fields.addAt(11, new Field({
|
|
||||||
"autogeneratePattern": "",
|
|
||||||
"hidden": false,
|
|
||||||
"id": "text1146066909",
|
|
||||||
"max": 0,
|
|
||||||
"min": 0,
|
|
||||||
"name": "phone",
|
|
||||||
"pattern": "",
|
|
||||||
"presentable": false,
|
|
||||||
"primaryKey": false,
|
|
||||||
"required": false,
|
|
||||||
"system": false,
|
|
||||||
"type": "text"
|
|
||||||
}))
|
|
||||||
|
|
||||||
return app.save(collection)
|
|
||||||
}, (app) => {
|
|
||||||
const collection = app.findCollectionByNameOrId("pbc_1305841361")
|
|
||||||
|
|
||||||
// remove field
|
|
||||||
collection.fields.removeById("text1146066909")
|
|
||||||
|
|
||||||
return app.save(collection)
|
|
||||||
})
|
|
@@ -1,20 +0,0 @@
|
|||||||
/// <reference path="../pb_data/types.d.ts" />
|
|
||||||
migrate((app) => {
|
|
||||||
const collection = app.findCollectionByNameOrId("pbc_1413424569")
|
|
||||||
|
|
||||||
// update collection data
|
|
||||||
unmarshal({
|
|
||||||
"name": "Teachers_xxx"
|
|
||||||
}, collection)
|
|
||||||
|
|
||||||
return app.save(collection)
|
|
||||||
}, (app) => {
|
|
||||||
const collection = app.findCollectionByNameOrId("pbc_1413424569")
|
|
||||||
|
|
||||||
// update collection data
|
|
||||||
unmarshal({
|
|
||||||
"name": "Teachers"
|
|
||||||
}, collection)
|
|
||||||
|
|
||||||
return app.save(collection)
|
|
||||||
})
|
|
@@ -1,17 +1,31 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
DB_COMPOSE_FILE="-f ./docker-compose.db.yml"
|
||||||
|
_COMPOSE_FILE="-f ./docker-compose.yml"
|
||||||
|
DEV_COMPOSE_FILE="-f ./docker-compose.dev.yml"
|
||||||
|
|
||||||
|
COMPOSE_FILES="$DB_COMPOSE_FILE $_COMPOSE_FILE $DEV_COMPOSE_FILE"
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
cd docker
|
||||||
|
|
||||||
|
docker compose $COMPOSE_FILES kill
|
||||||
|
docker compose $COMPOSE_FILES down
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
docker compose kill
|
docker compose $COMPOSE_FILES up -d pocketbase api_ts --remove-orphans
|
||||||
docker compose down
|
|
||||||
|
|
||||||
docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d pocketbase api_ts --remove-orphans
|
docker compose $COMPOSE_FILES logs pocketbase
|
||||||
# docker compose logs -f pocketbase api_ts
|
|
||||||
|
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
|
sudo chown 1000:1000 -R ./volumes
|
||||||
|
|
||||||
echo "please run yourself !!!!"
|
echo "please run yourself !!!!"
|
||||||
echo "nodemon -w /pb_hooks --exec "pocketbase seed""
|
echo "nodemon -w /pb_hooks --exec "pocketbase seed""
|
||||||
echo ""
|
echo ""
|
||||||
docker compose exec -it pocketbase sh
|
docker compose $COMPOSE_FILES exec -it pocketbase sh
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
@@ -12,6 +12,6 @@ rsync -avh \
|
|||||||
--exclude ".next" \
|
--exclude ".next" \
|
||||||
--exclude "node_modules" \
|
--exclude "node_modules" \
|
||||||
--exclude ".git" \
|
--exclude ".git" \
|
||||||
. ../_archive/022_init_lesson_categories
|
. ../_archive/023_init_lesson_categories
|
||||||
|
|
||||||
echo "done"
|
echo "done"
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
const fs = require("fs");
|
const fs = require('fs');
|
||||||
const path = require("path");
|
const path = require('path');
|
||||||
|
|
||||||
function removeNodeModules(dir) {
|
function removeNodeModules(dir) {
|
||||||
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
||||||
@@ -8,13 +8,13 @@ function removeNodeModules(dir) {
|
|||||||
const fullPath = path.join(dir, entry.name);
|
const fullPath = path.join(dir, entry.name);
|
||||||
|
|
||||||
if (entry.isDirectory()) {
|
if (entry.isDirectory()) {
|
||||||
if (entry.name === "node_modules") {
|
if (entry.name === 'node_modules') {
|
||||||
fs.rmSync(fullPath, { recursive: true });
|
fs.rmSync(fullPath, { recursive: true });
|
||||||
} else {
|
} else {
|
||||||
removeNodeModules(fullPath);
|
removeNodeModules(fullPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.name === ".next") {
|
if (entry.name === '.next') {
|
||||||
fs.rmSync(fullPath, { recursive: true });
|
fs.rmSync(fullPath, { recursive: true });
|
||||||
} else {
|
} else {
|
||||||
removeNodeModules(fullPath);
|
removeNodeModules(fullPath);
|
||||||
@@ -23,5 +23,5 @@ function removeNodeModules(dir) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
removeNodeModules(".");
|
removeNodeModules('.');
|
||||||
console.log("All 'node_modules' directories have been removed.");
|
console.log("All 'node_modules' directories have been removed.");
|
Reference in New Issue
Block a user