mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-01 19:49:54 +02:00
web: refactor props for Tags component
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
This commit is contained in:
@@ -358,7 +358,7 @@ function NavigationMenu(props: NavigationMenuProps) {
|
||||
>
|
||||
{CREATE_BUTTON_MAP.tags.title}
|
||||
</Button>
|
||||
<Tags location="sidebar" />
|
||||
<Tags isSidebar />
|
||||
</Flex>
|
||||
) : (
|
||||
<FlexScrollContainer
|
||||
|
||||
@@ -149,9 +149,6 @@ const routes = defineRoutes({
|
||||
title: strings.routes.Tags(),
|
||||
type: "tags",
|
||||
component: Tags,
|
||||
props: {
|
||||
location: "middle-pane"
|
||||
},
|
||||
buttons: {
|
||||
create: CREATE_BUTTON_MAP.tags,
|
||||
search: {
|
||||
|
||||
@@ -28,10 +28,10 @@ import { useEffect } from "react";
|
||||
import { navigate } from "../navigation";
|
||||
|
||||
type Props = {
|
||||
location: "middle-pane" | "sidebar";
|
||||
isSidebar?: boolean;
|
||||
};
|
||||
|
||||
function Tags({ location }: Props) {
|
||||
function Tags({ isSidebar }: Props) {
|
||||
useNavigate("tags", () => store.refresh());
|
||||
const tags = useStore((store) => store.tags);
|
||||
const refresh = useStore((store) => store.refresh);
|
||||
@@ -40,7 +40,7 @@ function Tags({ location }: Props) {
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (location === "sidebar") return;
|
||||
if (isSidebar) return;
|
||||
tags?.item(0).then((item) => {
|
||||
if (item && item?.item) {
|
||||
navigate(`/tags/${item.item.id}`);
|
||||
|
||||
Reference in New Issue
Block a user