mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 22:53:25 +00:00
refactor: split backend by context instead of type 'controllers/models/...'
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { Visibility } from '#enums/visibility';
|
||||
import { Link } from '@inertiajs/react';
|
||||
import { route } from '@izzyjs/route/client';
|
||||
import {
|
||||
@@ -19,6 +18,7 @@ import { IoTrashOutline } from 'react-icons/io5';
|
||||
import { ShareCollection } from '~/components/share/share_collection';
|
||||
import { appendCollectionId } from '~/lib/navigation';
|
||||
import { useActiveCollection } from '~/stores/collection_store';
|
||||
import { Visibility } from '~/types/app';
|
||||
|
||||
interface DashboardHeaderProps {
|
||||
navbar: {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import PATHS from '#constants/paths';
|
||||
import PATHS from '#core/constants/paths';
|
||||
import { Link } from '@inertiajs/react';
|
||||
import { route } from '@izzyjs/route/client';
|
||||
import { Anchor, Group, Text } from '@mantine/core';
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { Visibility } from '#enums/visibility';
|
||||
import { Box, Group, SegmentedControl, Text, TextInput } from '@mantine/core';
|
||||
import { FormEvent } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import BackToDashboard from '~/components/common/navigation/back_to_dashboard';
|
||||
import { FormLayout, FormLayoutProps } from '~/layouts/form_layout';
|
||||
import { Collection } from '~/types/app';
|
||||
import { Collection, Visibility } from '~/types/app';
|
||||
|
||||
export type FormCollectionData = {
|
||||
name: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import PATHS from '#constants/paths';
|
||||
import PATHS from '#core/constants/paths';
|
||||
import { Link } from '@inertiajs/react';
|
||||
import { route } from '@izzyjs/route/client';
|
||||
import {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Visibility } from '#enums/visibility';
|
||||
import { ActionIcon, Anchor, CopyButton, Popover, Text } from '@mantine/core';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { TbShare3 } from 'react-icons/tb';
|
||||
import { Fragment } from 'react/jsx-runtime';
|
||||
import { generateShareUrl } from '~/lib/navigation';
|
||||
import { useActiveCollection } from '~/stores/collection_store';
|
||||
import { Visibility } from '~/types/app';
|
||||
|
||||
const COPY_SUCCESS_TIMEOUT = 2_000;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import KEYS from '#constants/keys';
|
||||
import KEYS from '#core/constants/keys';
|
||||
import { useHotkeys } from 'react-hotkeys-hook';
|
||||
import { useGlobalHotkeysStore } from '~/stores/global_hotkeys_store';
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { router } from '@inertiajs/react';
|
||||
import { router, usePage } from '@inertiajs/react';
|
||||
import { ColorSchemeScript, createTheme, MantineProvider } from '@mantine/core';
|
||||
import dayjs from 'dayjs';
|
||||
import { ReactNode, useEffect } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { InertiaPage } from '~/types/inertia';
|
||||
|
||||
import '@mantine/core/styles.css';
|
||||
import '@mantine/spotlight/styles.css';
|
||||
@@ -14,6 +15,8 @@ const TRANSITION_OUT_CLASS = '__transition_fadeOut';
|
||||
|
||||
export default function BaseLayout({ children }: { children: ReactNode }) {
|
||||
const { i18n } = useTranslation();
|
||||
const { language } = usePage<InertiaPage>().props;
|
||||
i18n.changeLanguage(language);
|
||||
dayjs.locale(i18n.language);
|
||||
|
||||
const findAppElement = () => document.getElementById('app');
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Visibility } from '#enums/visibility';
|
||||
import { useForm } from '@inertiajs/react';
|
||||
import { route } from '@izzyjs/route/client';
|
||||
import { useMemo } from 'react';
|
||||
@@ -6,6 +5,7 @@ import { useTranslation } from 'react-i18next';
|
||||
import MantineFormCollection, {
|
||||
FormCollectionData,
|
||||
} from '~/components/form/form_collection';
|
||||
import { Visibility } from '~/types/app';
|
||||
|
||||
export default function CreateCollectionPage({
|
||||
disableHomeLink,
|
||||
|
||||
@@ -2,21 +2,12 @@
|
||||
"extends": "@adonisjs/tsconfig/tsconfig.client.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"target": "ESNext",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Bundler",
|
||||
"jsx": "react-jsx",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"paths": {
|
||||
"~/*": ["./*"],
|
||||
"@/*": ["../*"]
|
||||
},
|
||||
"types": ["vite/client"]
|
||||
"~/*": ["./*"]
|
||||
}
|
||||
},
|
||||
"include": ["./**/*.ts", "./**/*.tsx"]
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import { Visibility } from '@/app/enums/visibility';
|
||||
|
||||
type CommonBase = {
|
||||
id: number;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
|
||||
type User = CommonBase & {
|
||||
export type User = CommonBase & {
|
||||
email: string;
|
||||
fullname: string;
|
||||
avatarUrl: string;
|
||||
@@ -14,15 +12,15 @@ type User = CommonBase & {
|
||||
lastSeenAt: string;
|
||||
};
|
||||
|
||||
type PublicUser = Omit<User, 'email'>;
|
||||
export type PublicUser = Omit<User, 'email'>;
|
||||
|
||||
type Users = User[];
|
||||
export type Users = User[];
|
||||
|
||||
type UserWithCollections = User & {
|
||||
export type UserWithCollections = User & {
|
||||
collections: Collection[];
|
||||
};
|
||||
|
||||
type UserWithRelationCount = CommonBase & {
|
||||
export type UserWithRelationCount = CommonBase & {
|
||||
email: string;
|
||||
fullname: string;
|
||||
avatarUrl: string;
|
||||
@@ -32,7 +30,7 @@ type UserWithRelationCount = CommonBase & {
|
||||
lastSeenAt: string;
|
||||
};
|
||||
|
||||
type Link = CommonBase & {
|
||||
export type Link = CommonBase & {
|
||||
name: string;
|
||||
description: string | null;
|
||||
url: string;
|
||||
@@ -40,14 +38,14 @@ type Link = CommonBase & {
|
||||
collectionId: number;
|
||||
};
|
||||
|
||||
type LinkWithCollection = Link & {
|
||||
export type LinkWithCollection = Link & {
|
||||
collection: Collection;
|
||||
};
|
||||
|
||||
type PublicLink = Omit<Link, 'favorite'>;
|
||||
type PublicLinkWithCollection = Omit<Link, 'favorite'>;
|
||||
export type PublicLink = Omit<Link, 'favorite'>;
|
||||
export type PublicLinkWithCollection = Omit<Link, 'favorite'>;
|
||||
|
||||
type Collection = CommonBase & {
|
||||
export type Collection = CommonBase & {
|
||||
name: string;
|
||||
description: string | null;
|
||||
visibility: Visibility;
|
||||
@@ -55,6 +53,11 @@ type Collection = CommonBase & {
|
||||
authorId: number;
|
||||
};
|
||||
|
||||
type CollectionWithLinks = Collection & {
|
||||
export type CollectionWithLinks = Collection & {
|
||||
links: Link[];
|
||||
};
|
||||
|
||||
export enum Visibility {
|
||||
PUBLIC = 'PUBLIC',
|
||||
PRIVATE = 'PRIVATE',
|
||||
}
|
||||
Reference in New Issue
Block a user