mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-09 07:03:25 +00:00
feat: use route management system for collections
This commit is contained in:
@@ -13,12 +13,13 @@ const CollectionNameWrapper = styled.div({
|
||||
alignItems: 'center',
|
||||
});
|
||||
|
||||
const CollectionName = styled.div({
|
||||
const CollectionName = styled.div(({ theme }) => ({
|
||||
minWidth: 0,
|
||||
color: theme.colors.primary,
|
||||
textOverflow: 'ellipsis',
|
||||
whiteSpace: 'nowrap',
|
||||
overflow: 'hidden',
|
||||
});
|
||||
}));
|
||||
|
||||
const LinksCount = styled.div(({ theme }) => ({
|
||||
minWidth: 'fit-content',
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import PATHS from '#constants/paths';
|
||||
import styled from '@emotion/styled';
|
||||
import { route } from '@izzyjs/route/client';
|
||||
import { AiOutlineFolderAdd } from 'react-icons/ai';
|
||||
import { BsGear } from 'react-icons/bs';
|
||||
import { IoAdd } from 'react-icons/io5';
|
||||
import { MdOutlineAdminPanelSettings } from 'react-icons/md';
|
||||
import FavoriteList from '~/components/dashboard/side_nav/favorite/favorite_list';
|
||||
import { ItemLink } from '~/components/dashboard/side_nav/nav_item';
|
||||
import { Item, ItemLink } from '~/components/dashboard/side_nav/nav_item';
|
||||
import UserCard from '~/components/dashboard/side_nav/user_card';
|
||||
import useActiveCollection from '~/hooks/use_active_collection';
|
||||
import { appendCollectionId } from '~/lib/navigation';
|
||||
|
||||
const SideMenu = styled.nav({
|
||||
height: '100%',
|
||||
@@ -15,11 +17,11 @@ const SideMenu = styled.nav({
|
||||
flexDirection: 'column',
|
||||
});
|
||||
|
||||
const AdminButton = styled(ItemLink)(({ theme }) => ({
|
||||
const AdminButton = styled(Item)(({ theme }) => ({
|
||||
color: theme.colors.lightRed,
|
||||
}));
|
||||
|
||||
const SettingsButton = styled(ItemLink)(({ theme }) => ({
|
||||
const SettingsButton = styled(Item)(({ theme }) => ({
|
||||
color: theme.colors.grey,
|
||||
}));
|
||||
|
||||
@@ -27,26 +29,32 @@ const AddButton = styled(ItemLink)(({ theme }) => ({
|
||||
color: theme.colors.primary,
|
||||
}));
|
||||
|
||||
const SideNavigation = () => (
|
||||
<SideMenu>
|
||||
<div css={{ paddingInline: '10px' }}>
|
||||
<UserCard />
|
||||
<AdminButton href="/admin">
|
||||
<MdOutlineAdminPanelSettings /> Administrator
|
||||
</AdminButton>
|
||||
<SettingsButton href="/settings">
|
||||
<BsGear />
|
||||
Settings
|
||||
</SettingsButton>
|
||||
<AddButton href={PATHS.LINK.CREATE}>
|
||||
<IoAdd /> Create link
|
||||
</AddButton>
|
||||
<AddButton href={PATHS.COLLECTION.CREATE}>
|
||||
<AiOutlineFolderAdd /> Create collection
|
||||
</AddButton>
|
||||
</div>
|
||||
<FavoriteList />
|
||||
</SideMenu>
|
||||
);
|
||||
|
||||
export default SideNavigation;
|
||||
export default function SideNavigation() {
|
||||
const { activeCollection } = useActiveCollection();
|
||||
return (
|
||||
<SideMenu>
|
||||
<div css={{ paddingInline: '10px' }}>
|
||||
<UserCard />
|
||||
<AdminButton>
|
||||
<MdOutlineAdminPanelSettings /> Administrator
|
||||
</AdminButton>
|
||||
<SettingsButton>
|
||||
<BsGear />
|
||||
Settings
|
||||
</SettingsButton>
|
||||
<AddButton
|
||||
href={appendCollectionId(
|
||||
route('link.create-form').url,
|
||||
activeCollection?.id
|
||||
)}
|
||||
>
|
||||
<IoAdd /> Create link
|
||||
</AddButton>
|
||||
<AddButton href={route('collection.create-form').url}>
|
||||
<AiOutlineFolderAdd /> Create collection
|
||||
</AddButton>
|
||||
</div>
|
||||
<FavoriteList />
|
||||
</SideMenu>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user