mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-09 15:05:26 +03:00
only link to profile settings in status bar for admin users
This commit is contained in:
parent
d830d47c9b
commit
e9268c1b59
@ -7,6 +7,7 @@ import useStats, { useAutoFrigateStats } from "@/hooks/use-stats";
|
|||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import type { ProfilesApiResponse } from "@/types/profile";
|
import type { ProfilesApiResponse } from "@/types/profile";
|
||||||
import { getProfileColor } from "@/utils/profileColors";
|
import { getProfileColor } from "@/utils/profileColors";
|
||||||
|
import { useIsAdmin } from "@/hooks/use-is-admin";
|
||||||
import { useContext, useEffect, useMemo } from "react";
|
import { useContext, useEffect, useMemo } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
@ -18,6 +19,7 @@ import { Link } from "react-router-dom";
|
|||||||
|
|
||||||
export default function Statusbar() {
|
export default function Statusbar() {
|
||||||
const { t } = useTranslation(["views/system"]);
|
const { t } = useTranslation(["views/system"]);
|
||||||
|
const isAdmin = useIsAdmin();
|
||||||
|
|
||||||
const { messages, addMessage, clearMessages } = useContext(
|
const { messages, addMessage, clearMessages } = useContext(
|
||||||
StatusBarMessagesContext,
|
StatusBarMessagesContext,
|
||||||
@ -154,7 +156,8 @@ export default function Statusbar() {
|
|||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
{activeProfile && (
|
{activeProfile &&
|
||||||
|
(isAdmin ? (
|
||||||
<Link to="/settings?page=profiles">
|
<Link to="/settings?page=profiles">
|
||||||
<div className="flex cursor-pointer items-center gap-2 text-sm hover:underline">
|
<div className="flex cursor-pointer items-center gap-2 text-sm hover:underline">
|
||||||
<span
|
<span
|
||||||
@ -168,7 +171,19 @@ export default function Statusbar() {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
|
) : (
|
||||||
|
<div className="flex items-center gap-2 text-sm">
|
||||||
|
<span
|
||||||
|
className={cn(
|
||||||
|
"size-2 shrink-0 rounded-full",
|
||||||
|
activeProfile.color.dot,
|
||||||
)}
|
)}
|
||||||
|
/>
|
||||||
|
<span className="max-w-[150px] truncate">
|
||||||
|
{activeProfile.friendlyName}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className="no-scrollbar flex h-full max-w-[50%] items-center gap-2 overflow-x-auto">
|
<div className="no-scrollbar flex h-full max-w-[50%] items-center gap-2 overflow-x-auto">
|
||||||
{Object.entries(messages).length === 0 ? (
|
{Object.entries(messages).length === 0 ? (
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user