Skip to content

Commit

Permalink
enhance: add meta title for routes/pages
Browse files Browse the repository at this point in the history
  • Loading branch information
ivyjeong13 committed Dec 30, 2024
1 parent af3cce0 commit 2f7ef32
Show file tree
Hide file tree
Showing 12 changed files with 62 additions and 5 deletions.
5 changes: 5 additions & 0 deletions ui/admin/app/routes/_auth.agents.$agent.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useCallback } from "react";
import {
ClientLoaderFunctionArgs,
MetaFunction,
redirect,
useLoaderData,
useMatch,
Expand Down Expand Up @@ -113,3 +114,7 @@ const AgentBreadcrumb = () => {
export const handle: RouteHandle = {
breadcrumb: () => [{ content: <AgentBreadcrumb /> }],
};

export const meta: MetaFunction<typeof clientLoader> = ({ data }) => {
return [{ title: `Obot | Agent "${data?.agent?.name}"` }];
};
6 changes: 5 additions & 1 deletion ui/admin/app/routes/_auth.agents._index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { PlusIcon } from "@radix-ui/react-icons";
import { ColumnDef, createColumnHelper } from "@tanstack/react-table";
import { SquarePen } from "lucide-react";
import { useMemo } from "react";
import { useNavigate } from "react-router";
import { MetaFunction, useNavigate } from "react-router";
import { $path } from "safe-routes";
import useSWR, { mutate, preload } from "swr";

Expand Down Expand Up @@ -174,3 +174,7 @@ export default function Agents() {
}

const columnHelper = createColumnHelper<Agent>();

export const meta: MetaFunction = () => {
return [{ title: "Obot | Agents" }];
};
5 changes: 5 additions & 0 deletions ui/admin/app/routes/_auth.model-providers.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { MetaFunction } from "react-router";
import { preload } from "swr";

import { ModelProvider } from "~/lib/model/modelProviders";
Expand Down Expand Up @@ -92,3 +93,7 @@ export default function ModelProviders() {
export const handle: RouteHandle = {
breadcrumb: () => [{ content: "Model Providers" }],
};

export const meta: MetaFunction = () => {
return [{ title: `Obot | Model Providers` }];
};
5 changes: 5 additions & 0 deletions ui/admin/app/routes/_auth.oauth-apps.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { MetaFunction } from "react-router";
import { preload } from "swr";

import { OauthAppService } from "~/lib/service/api/oauthAppService";
Expand Down Expand Up @@ -38,3 +39,7 @@ export default function OauthApps() {
export const handle: RouteHandle = {
breadcrumb: () => [{ content: "OAuth Apps" }],
};

export const meta: MetaFunction = () => {
return [{ title: `Obot | Oauth Apps` }];
};
5 changes: 5 additions & 0 deletions ui/admin/app/routes/_auth.threads.$id.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ArrowLeftIcon } from "lucide-react";
import {
ClientLoaderFunctionArgs,
Link,
MetaFunction,
redirect,
useLoaderData,
useMatch,
Expand Down Expand Up @@ -134,3 +135,7 @@ export const handle: RouteHandle = {
{ content: <ThreadBreadcrumb /> },
],
};

export const meta: MetaFunction<typeof clientLoader> = ({ data }) => {
return [{ title: `Obot | Thread "${data?.thread.id}"` }];
};
5 changes: 5 additions & 0 deletions ui/admin/app/routes/_auth.threads._index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useMemo } from "react";
import {
ClientLoaderFunctionArgs,
Link,
MetaFunction,
useLoaderData,
useNavigate,
useSearchParams,
Expand Down Expand Up @@ -358,3 +359,7 @@ export const handle: RouteHandle = {
breadcrumb: ({ search }) =>
[getFromBreadcrumb(search), { content: "Threads" }].filter((x) => !!x),
};

export const meta: MetaFunction = () => {
return [{ title: `Obot | Threads` }];
};
5 changes: 5 additions & 0 deletions ui/admin/app/routes/_auth.tools._index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { PlusIcon, SearchIcon } from "lucide-react";
import { useState } from "react";
import { MetaFunction } from "react-router";
import useSWR, { preload } from "swr";

import { ToolReferenceService } from "~/lib/service/api/toolreferenceService";
Expand Down Expand Up @@ -118,3 +119,7 @@ export default function Tools() {
export const handle: RouteHandle = {
breadcrumb: () => [{ content: "Tools" }],
};

export const meta: MetaFunction = () => {
return [{ title: `Obot | Tools` }];
};
5 changes: 5 additions & 0 deletions ui/admin/app/routes/_auth.users.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ColumnDef, createColumnHelper } from "@tanstack/react-table";
import { useMemo } from "react";
import { MetaFunction } from "react-router";
import { $path } from "safe-routes";
import useSWR, { preload } from "swr";

Expand Down Expand Up @@ -117,3 +118,7 @@ const columnHelper = createColumnHelper<User>();
export const handle: RouteHandle = {
breadcrumb: () => [{ content: "Users" }],
};

export const meta: MetaFunction = () => {
return [{ title: `Obot | Users` }];
};
9 changes: 7 additions & 2 deletions ui/admin/app/routes/_auth.webhooks.$webhook.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
ClientLoaderFunctionArgs,
MetaFunction,
useLoaderData,
useMatch,
} from "react-router";
Expand All @@ -21,12 +22,12 @@ export async function clientLoader({
params
);

await preload(
const webhook = await preload(
WebhookApiService.getWebhookById.key(pathParams.webhook),
() => WebhookApiService.getWebhookById(pathParams.webhook)
);

return { webhookId: pathParams.webhook };
return { webhookId: pathParams.webhook, webhook };
}

export default function Webhook() {
Expand Down Expand Up @@ -54,3 +55,7 @@ const WebhookBreadcrumb = () => {
export const handle: RouteHandle = {
breadcrumb: () => [{ content: <WebhookBreadcrumb /> }],
};

export const meta: MetaFunction<typeof clientLoader> = ({ data }) => {
return [{ title: `Obot | Webhook "${data?.webhook.name}"` }];
};
6 changes: 5 additions & 1 deletion ui/admin/app/routes/_auth.webhooks._index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ColumnDef, createColumnHelper } from "@tanstack/react-table";
import { PlusIcon } from "lucide-react";
import { useMemo } from "react";
import { useNavigate } from "react-router";
import { MetaFunction, useNavigate } from "react-router";
import { $path } from "safe-routes";
import useSWR, { preload } from "swr";

Expand Down Expand Up @@ -100,3 +100,7 @@ export default function WebhooksPage() {
}

const columnHelper = createColumnHelper<Webhook>();

export const meta: MetaFunction = () => {
return [{ title: `Obot | Webhooks` }];
};
5 changes: 5 additions & 0 deletions ui/admin/app/routes/_auth.workflows.$workflow.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useCallback } from "react";
import {
ClientLoaderFunctionArgs,
MetaFunction,
redirect,
useLoaderData,
useMatch,
Expand Down Expand Up @@ -105,3 +106,7 @@ const WorkflowBreadcrumb = () => {
export const handle: RouteHandle = {
breadcrumb: () => [{ content: <WorkflowBreadcrumb /> }],
};

export const meta: MetaFunction<typeof clientLoader> = ({ data }) => {
return [{ title: `Obot | Workflow "${data?.workflow.name}"` }];
};
6 changes: 5 additions & 1 deletion ui/admin/app/routes/_auth.workflows._index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ColumnDef, createColumnHelper } from "@tanstack/react-table";
import { PenSquareIcon } from "lucide-react";
import { useMemo } from "react";
import { useNavigate } from "react-router";
import { MetaFunction, useNavigate } from "react-router";
import { $path } from "safe-routes";
import useSWR, { mutate, preload } from "swr";

Expand Down Expand Up @@ -166,3 +166,7 @@ export default function Workflows() {
}

const columnHelper = createColumnHelper<Workflow>();

export const meta: MetaFunction = () => {
return [{ title: `Obot | Workflows` }];
};

0 comments on commit 2f7ef32

Please sign in to comment.