feat: add backup recovery, setup wizard and user-view guards
This commit is contained in:
@@ -5,6 +5,7 @@ import EmailReportControl from "./EmailReportControl";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { authFetch, getApiBase } from "../../lib/auth";
|
||||
import { useEffectiveRole } from "../../lib/viewMode";
|
||||
import PageHeading from "../../ui/PageHeading";
|
||||
import {
|
||||
type Stats,
|
||||
@@ -67,6 +68,7 @@ export default function MonthlyReportsPage() {
|
||||
const [monthReady, setMonthReady] = useState(false);
|
||||
const [months, setMonths] = useState<string[]>([]);
|
||||
const [data, setData] = useState<MonthlyReport | null>(null);
|
||||
const isAdmin = useEffectiveRole(data?.is_admin ? "admin" : "user") === "admin";
|
||||
const [busy, setBusy] = useState(true);
|
||||
const [error, setError] = useState("");
|
||||
const [revision, setRevision] = useState(0);
|
||||
@@ -267,11 +269,11 @@ export default function MonthlyReportsPage() {
|
||||
<section className="stats-state">
|
||||
<h2>Your monthly story starts here</h2>
|
||||
<p>
|
||||
{data.is_admin
|
||||
{isAdmin
|
||||
? "Connect Jellystat to bring your monthly viewing reports into Magent."
|
||||
: "Monthly reports will appear once your administrator connects Jellystat."}
|
||||
</p>
|
||||
{data.is_admin && (
|
||||
{isAdmin && (
|
||||
<a className="stats-action" href="/admin/jellystat">
|
||||
Connect Jellystat
|
||||
</a>
|
||||
@@ -285,7 +287,7 @@ export default function MonthlyReportsPage() {
|
||||
Your report needs your Jellyfin account link. Sign in using Jellyfin, or ask your administrator to review
|
||||
your user identities.
|
||||
</p>
|
||||
{data.is_admin && (
|
||||
{isAdmin && (
|
||||
<a className="stats-action" href="/admin/identities">
|
||||
Review user identities
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user