web: refactor props for Tags component

Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
This commit is contained in:
01zulfi
2025-01-07 11:52:13 +05:00
committed by Abdullah Atta
parent 56046f5695
commit e42c858319
3 changed files with 4 additions and 7 deletions

View File

@@ -358,7 +358,7 @@ function NavigationMenu(props: NavigationMenuProps) {
>
{CREATE_BUTTON_MAP.tags.title}
</Button>
<Tags location="sidebar" />
<Tags isSidebar />
</Flex>
) : (
<FlexScrollContainer

View File

@@ -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: {

View File

@@ -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}`);