feat: migrate from paths constant to new route management system

This commit is contained in:
Sonny
2024-05-16 18:53:53 +02:00
committed by Sonny
parent 905f0ba1c7
commit 57ed2c5e94
20 changed files with 82 additions and 75 deletions

View File

@@ -1,5 +1,4 @@
import KEYS from '#constants/keys';
import PATHS from '#constants/paths';
import type Collection from '#models/collection';
import Link from '#models/link';
import styled from '@emotion/styled';
@@ -116,14 +115,16 @@ function DashboardProviders(
useHotkeys(
KEYS.OPEN_CREATE_LINK_KEY,
() => {
router.visit(`${PATHS.LINK.CREATE}?collectionId=${activeCollection?.id}`);
router.visit(
appendCollectionId(route('link.create-form').url, activeCollection?.id)
);
},
{ enabled: globalHotkeysEnabled }
);
useHotkeys(
KEYS.OPEN_CREATE_COLLECTION_KEY,
() => {
router.visit(PATHS.COLLECTION.CREATE);
router.visit(route('collection.create-form').url);
},
{ enabled: globalHotkeysEnabled }
);

View File

@@ -1,10 +1,9 @@
import { route } from '@izzyjs/route/client';
import ContentLayout from '~/components/layouts/content_layout';
import PATHS from '../../app/constants/paths';
export default function LoginPage() {
return (
<ContentLayout>
<a href={PATHS.AUTH.GOOGLE}>Continue with Google</a>
</ContentLayout>
);
}
const LoginPage = () => (
<ContentLayout>
<a href={route('auth.google').url}>Continue with Google</a>
</ContentLayout>
);
export default LoginPage;