Skip to content

Commit

Permalink
feat: add admin link
Browse files Browse the repository at this point in the history
  • Loading branch information
zmh-program committed Mar 18, 2024
1 parent 4b50ab2 commit aefe8a0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
19 changes: 17 additions & 2 deletions app/src/components/home/ChatSpace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import { useState } from "react";
import { useTranslation } from "react-i18next";
import { useSelector } from "react-redux";
import { Button } from "@/components/ui/button.tsx";
import { ChevronRight, FolderKanban, Newspaper, Users2 } from "lucide-react";
import {
ChevronRight,
FolderKanban,
Newspaper,
Shield,
Users2,
} from "lucide-react";
import router from "@/router.tsx";
import {
Dialog,
Expand All @@ -11,7 +17,7 @@ import {
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog.tsx";
import { selectAuthenticated } from "@/store/auth.ts";
import { selectAdmin, selectAuthenticated } from "@/store/auth.ts";
import { appLogo } from "@/conf/env.ts";
import {
infoArticleSelector,
Expand Down Expand Up @@ -40,6 +46,7 @@ function ChatSpace() {
const [open, setOpen] = useState(false);
const { t } = useTranslation();
const contact = useSelector(infoContactSelector);
const admin = useSelector(selectAdmin);

const generationGroup = useSelector(infoGenerationSelector);
const generation = hitGroup(generationGroup);
Expand All @@ -55,6 +62,14 @@ function ChatSpace() {
alt={``}
/>

{admin && (
<Button variant={`outline`} onClick={() => router.navigate("/admin")}>
<Shield className={`h-4 w-4 mr-1.5`} />
{t("admin.users")}
<ChevronRight className={`h-4 w-4 ml-2`} />
</Button>
)}

{contact.length > 0 && (
<Button variant={`outline`} onClick={() => setOpen(true)}>
<Users2 className={`h-4 w-4 mr-1.5`} />
Expand Down
4 changes: 2 additions & 2 deletions app/src/resources/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@
}
},
"market": {
"title": "Model Market",
"title": "Model Marketplace",
"model": "Explore more models",
"explore": "Explore",
"search": "Search model name or description",
"model-api": "Model ID name of the API request",
"list": "Model List",
"go": "Go to the model market"
"go": "Go to the model marketplace"
},
"conversation": {
"title": "Conversation",
Expand Down

0 comments on commit aefe8a0

Please sign in to comment.