Remove issue reports and refine users list and detail UX.

Drop the issues feature from admin, simplify user status/region filters, and tighten user detail field layout.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Yared Yemane 2026-08-04 16:52:05 +03:00
parent 992ca85690
commit 13217ae6b5
12 changed files with 80 additions and 1237 deletions

View File

@ -1,30 +0,0 @@
import http from "./http";
import type {
GetIssuesResponse,
GetIssueResponse,
UpdateIssueStatusResponse,
DeleteIssueResponse,
IssueFilters,
} from "../types/issue.types";
import type { CreateIssueRequest, CreateIssueResponse } from "../types/issue.types";
export const getIssues = (filters?: IssueFilters) =>
http.get<GetIssuesResponse>("/issues", {
params: filters,
});
export const getIssuesByUserId = (userId: number) =>
http.get<GetIssuesResponse>(`/issues/user/${userId}`);
export const getIssueById = (id: number) =>
http.get<GetIssueResponse>(`/issues/${id}`);
export const createIssue = (payload: CreateIssueRequest) =>
http.post<CreateIssueResponse>("/issues", payload);
export const updateIssueStatus = (id: number, status: string) =>
http.patch<UpdateIssueStatusResponse>(`/issues/${id}/status`, { status });
export const deleteIssue = (id: number) =>
http.delete<DeleteIssueResponse>(`/issues/${id}`);

View File

@ -396,7 +396,9 @@ export function normalizeUserSubscriptions(raw: unknown): UserSubscriptionsData
}; };
} }
/** Query params for GET /users (RFC3339 for created_*; subscription_status: ACTIVE | PENDING | Unsubscribed). */ /** Query params for GET /users (RFC3339 for created_*; subscription_status: ACTIVE | PENDING | Unsubscribed).
* status: ACTIVE | PENDING | SUSPENDED | DEACTIVATED | INACTIVE (all statuses except ACTIVE).
*/
export interface GetUsersParams { export interface GetUsersParams {
page?: number page?: number
page_size?: number page_size?: number

View File

@ -57,7 +57,6 @@ import { AddQuestionPage } from "../pages/content-management/AddQuestionPage";
import { HumanLanguageHierarchyPage } from "../pages/content-management/HumanLanguageHierarchyPage"; import { HumanLanguageHierarchyPage } from "../pages/content-management/HumanLanguageHierarchyPage";
import { HumanLanguageSubModulePage } from "../pages/content-management/HumanLanguageSubModulePage"; import { HumanLanguageSubModulePage } from "../pages/content-management/HumanLanguageSubModulePage";
import { UserLogPage } from "../pages/user-log/UserLogPage"; import { UserLogPage } from "../pages/user-log/UserLogPage";
import { IssuesPage } from "../pages/issues/IssuesPage";
import { PaymentsPage } from "../pages/payments/PaymentsPage"; import { PaymentsPage } from "../pages/payments/PaymentsPage";
import { SubscriptionsExportPage } from "../pages/subscriptions/SubscriptionsExportPage"; import { SubscriptionsExportPage } from "../pages/subscriptions/SubscriptionsExportPage";
import { ProfilePage } from "../pages/ProfilePage"; import { ProfilePage } from "../pages/ProfilePage";
@ -347,7 +346,6 @@ export function AppRoutes() {
<Route path="/payments" element={<PaymentsPage />} /> <Route path="/payments" element={<PaymentsPage />} />
<Route path="/subscriptions/export" element={<SubscriptionsExportPage />} /> <Route path="/subscriptions/export" element={<SubscriptionsExportPage />} />
<Route path="/user-log" element={<UserLogPage />} /> <Route path="/user-log" element={<UserLogPage />} />
<Route path="/issues" element={<IssuesPage />} />
<Route path="/help/faqs" element={<FaqsPage />} /> <Route path="/help/faqs" element={<FaqsPage />} />
<Route path="/help/faqs/:id/edit" element={<EditFaqPage />} /> <Route path="/help/faqs/:id/edit" element={<EditFaqPage />} />
<Route path="/app-reviews" element={<AppReviewsPage />} /> <Route path="/app-reviews" element={<AppReviewsPage />} />

View File

@ -4,7 +4,6 @@ import {
BookOpen, BookOpen,
ChevronLeft, ChevronLeft,
ChevronRight, ChevronRight,
CircleAlert,
CircleHelp, CircleHelp,
ClipboardList, ClipboardList,
CreditCard, CreditCard,
@ -126,7 +125,6 @@ const navEntries: NavEntry[] = [
icon: ClipboardList, icon: ClipboardList,
permission: "activity_logs.list", permission: "activity_logs.list",
}, },
{ kind: "link", label: "Issue reports", to: "/issues", icon: CircleAlert },
{ {
kind: "link", kind: "link",
label: "FAQs", label: "FAQs",

View File

@ -236,7 +236,6 @@ export const RESOURCE_TYPE_OPTIONS: { value: string; label: string }[] = [
{ value: "FILE", label: "File" }, { value: "FILE", label: "File" },
{ value: "REFERRAL", label: "Referral" }, { value: "REFERRAL", label: "Referral" },
{ value: "ASSESSMENT_QUESTION", label: "Assessment question" }, { value: "ASSESSMENT_QUESTION", label: "Assessment question" },
{ value: "ISSUE", label: "Issue" },
{ value: "RATING", label: "Rating" }, { value: "RATING", label: "Rating" },
] ]
@ -353,8 +352,6 @@ export function activityLogResourcePath(
return `/notifications/email-templates` return `/notifications/email-templates`
case "SUBSCRIPTION_PLAN": case "SUBSCRIPTION_PLAN":
return `/settings` return `/settings`
case "ISSUE":
return `/issues`
default: default:
return null return null
} }

View File

@ -7,7 +7,6 @@ import {
HelpCircle, HelpCircle,
MessageSquare, MessageSquare,
Star, Star,
TicketCheck,
// TrendingUp, // TrendingUp,
Users, Users,
UserX, UserX,
@ -179,12 +178,6 @@ export function DashboardPage() {
dashboard?.subscriptions.by_status, dashboard?.subscriptions.by_status,
PIE_COLORS, PIE_COLORS,
) )
const issueStatusData =
dashboard?.issues.by_status.map((s, i) => ({
name: s.label,
value: s.count,
color: PIE_COLORS[i % PIE_COLORS.length],
})) ?? []
const seriesPeriodLabel = dashboard ? getSeriesPeriodLabel(dashboard.date_filter) : "Last 30 Days" const seriesPeriodLabel = dashboard ? getSeriesPeriodLabel(dashboard.date_filter) : "Last 30 Days"
const subscriptionMetrics = dashboard const subscriptionMetrics = dashboard
@ -306,13 +299,6 @@ export function DashboardPage() {
deltaLabel={`${dashboard.payments.total_payments} payments`} deltaLabel={`${dashboard.payments.total_payments} payments`}
deltaPositive={dashboard.payments.total_revenue > 0} deltaPositive={dashboard.payments.total_revenue > 0}
/> />
<StatCard
icon={TicketCheck}
label="Issues"
value={`${dashboard.issues.resolved_issues}/${dashboard.issues.total_issues}`}
deltaLabel={`${(dashboard.issues.resolution_rate * 100).toFixed(1)}% resolved`}
deltaPositive={dashboard.issues.resolution_rate > 0.5}
/>
</div> </div>
)} )}
@ -499,13 +485,6 @@ export function DashboardPage() {
countSuffix="Subscriptions" countSuffix="Subscriptions"
/> />
) : null} ) : null}
{issueStatusData.length > 0 ? (
<DonutBreakdownCard
title="Issue Status"
data={issueStatusData}
countSuffix="Issues"
/>
) : null}
</div> </div>
</div> </div>
</section> </section>

View File

@ -25,7 +25,6 @@ import {
BookOpen, BookOpen,
HelpCircle, HelpCircle,
Bell, Bell,
TicketCheck,
UsersRound, UsersRound,
TrendingUp, TrendingUp,
TrendingDown, TrendingDown,
@ -444,7 +443,7 @@ export function AnalyticsPage() {
) )
} }
const { users, subscriptions, payments, courses, content, notifications, issues, team, videos } = dashboard const { users, subscriptions, payments, courses, content, notifications, team, videos } = dashboard
const subscriptionMetrics = getSubscriptionMetrics(subscriptions) const subscriptionMetrics = getSubscriptionMetrics(subscriptions)
const seriesPeriodLabel = getSeriesPeriodLabel(dashboard.date_filter) const seriesPeriodLabel = getSeriesPeriodLabel(dashboard.date_filter)
const lms = courses.lms const lms = courses.lms
@ -521,12 +520,6 @@ export function AnalyticsPage() {
? aggregateRevenueByMonth(payments.revenue_last_30_days, monthlyTrendYear) ? aggregateRevenueByMonth(payments.revenue_last_30_days, monthlyTrendYear)
: revenueData : revenueData
const issueStatusPie = issues.by_status.map((s, i) => ({
name: s.label,
value: s.count,
color: PIE_COLORS[i % PIE_COLORS.length],
}))
const subscriptionStatusPie = buildSubscriptionStatusPie( const subscriptionStatusPie = buildSubscriptionStatusPie(
subscriptions.by_status, subscriptions.by_status,
PIE_COLORS, PIE_COLORS,
@ -668,13 +661,6 @@ export function AnalyticsPage() {
} }
trend={payments.total_revenue > 0 ? "up" : "neutral"} trend={payments.total_revenue > 0 ? "up" : "neutral"}
/> />
<KpiCard
icon={TicketCheck}
label="Issue Resolution"
value={`${(issues.resolution_rate * 100).toFixed(1)}%`}
sub={`${issues.resolved_issues} resolved of ${issues.total_issues} total`}
trend={issues.resolution_rate >= 0.5 ? "up" : "down"}
/>
</div> </div>
</Section> </Section>
</> </>
@ -1194,20 +1180,6 @@ export function AnalyticsPage() {
</div> </div>
</Section> </Section>
{/* ─── Issues & Support ─── */}
<Section title="Issues & Support" icon={TicketCheck} count={issues.total_issues} defaultOpen={false}>
<div className="grid items-start gap-4 lg:grid-cols-3">
<DonutCard
title="Issue Status"
data={issueStatusPie}
centerValue={issues.total_issues.toString()}
centerLabel="Total"
/>
<BreakdownList title="Issues by Type" data={issues.by_type} total={issues.total_issues} />
<BreakdownList title="Issues by Status" data={issues.by_status} total={issues.total_issues} />
</div>
</Section>
{/* ─── Notifications ─── */} {/* ─── Notifications ─── */}
<Section title="Notifications" icon={Bell} count={notifications.total_sent} defaultOpen={false}> <Section title="Notifications" icon={Bell} count={notifications.total_sent} defaultOpen={false}>
<div className="grid items-start gap-4 sm:grid-cols-2 lg:grid-cols-3"> <div className="grid items-start gap-4 sm:grid-cols-2 lg:grid-cols-3">

File diff suppressed because it is too large Load Diff

View File

@ -64,6 +64,8 @@ function formatRoleLabel(role: string): string {
function formatStatusLabel(status: string): string { function formatStatusLabel(status: string): string {
const value = status.trim(); const value = status.trim();
if (!value) return NOT_ASSIGNED_LABEL; if (!value) return NOT_ASSIGNED_LABEL;
const normalized = value.toUpperCase();
if (normalized === "DEACTIVATED") return "Inactive";
return value return value
.split("_") .split("_")
.map((part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase()) .map((part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase())
@ -288,7 +290,7 @@ export function UserDetailPage() {
setUser((prev) => (prev ? { ...prev, status: nextStatus } : prev)); setUser((prev) => (prev ? { ...prev, status: nextStatus } : prev));
try { try {
await updateUserStatus({ user_id: user.id, status: nextStatus }); await updateUserStatus({ user_id: user.id, status: nextStatus });
toast.success(`User ${nextActive ? "activated" : "deactivated"} successfully`); toast.success(`User ${nextActive ? "activated" : "set to inactive"} successfully`);
} catch (err: unknown) { } catch (err: unknown) {
setUser((prev) => (prev ? { ...prev, status: previousStatus } : prev)); setUser((prev) => (prev ? { ...prev, status: previousStatus } : prev));
notifyApiError(err, "Failed to update user status"); notifyApiError(err, "Failed to update user status");
@ -399,10 +401,10 @@ export function UserDetailPage() {
<Icon className="h-4 w-4 text-grayScale-400" /> <Icon className="h-4 w-4 text-grayScale-400" />
</div> </div>
<div className="min-w-0"> <div className="min-w-0">
<p className="text-[11px] font-medium uppercase tracking-wider text-grayScale-400"> <p className="text-[11px] font-medium uppercase leading-tight tracking-wider text-grayScale-400">
{label} {label}
</p> </p>
<p className="truncate text-sm text-grayScale-700">{value}</p> <p className="truncate text-sm leading-snug text-grayScale-700">{value}</p>
</div> </div>
</div> </div>
))} ))}
@ -414,7 +416,6 @@ export function UserDetailPage() {
<InfoRow label="Joined" value={formatDate(user.created_at)} /> <InfoRow label="Joined" value={formatDate(user.created_at)} />
<InfoRow label="Last login" value={formatDateTime(user.last_login, "Never")} /> <InfoRow label="Last login" value={formatDateTime(user.last_login, "Never")} />
<InfoRow label="Gender" value={<DisplayValue value={user.gender} />} /> <InfoRow label="Gender" value={<DisplayValue value={user.gender} />} />
<InfoRow label="Birthday" value={formatDate(user.birth_day)} />
<InfoRow label="Occupation" value={<DisplayValue value={user.occupation} />} /> <InfoRow label="Occupation" value={<DisplayValue value={user.occupation} />} />
</div> </div>
</CardContent> </CardContent>
@ -466,7 +467,7 @@ export function UserDetailPage() {
</div> </div>
</CardHeader> </CardHeader>
<CardContent className="space-y-5"> <CardContent className="space-y-5">
<div className="grid grid-cols-1 gap-x-6 gap-y-4 sm:grid-cols-2"> <div className="grid grid-cols-1 gap-x-6 gap-y-3 sm:grid-cols-2">
<InfoItem label="Education level" value={<DisplayValue value={user.education_level} />} /> <InfoItem label="Education level" value={<DisplayValue value={user.education_level} />} />
<InfoItem label="Age group" value={formatAgeGroup(user.age_group)} /> <InfoItem label="Age group" value={formatAgeGroup(user.age_group)} />
<InfoItem label="Favorite topic" value={<DisplayValue value={user.favoutite_topic} />} /> <InfoItem label="Favorite topic" value={<DisplayValue value={user.favoutite_topic} />} />
@ -576,7 +577,10 @@ export function UserDetailPage() {
<p className="text-sm leading-relaxed text-grayScale-600"> <p className="text-sm leading-relaxed text-grayScale-600">
Are you sure you want to change the status of{" "} Are you sure you want to change the status of{" "}
<span className="font-semibold">{fullName || "this user"}</span> to{" "} <span className="font-semibold">{fullName || "this user"}</span> to{" "}
<span className="font-semibold capitalize">{confirmDialog.nextStatus.toLowerCase()}</span>? <span className="font-semibold">
{confirmDialog.nextStatus === "DEACTIVATED" ? "Inactive" : "Active"}
</span>
?
</p> </p>
</div> </div>
<div className="flex flex-col-reverse gap-3 border-t border-grayScale-100 px-6 py-4 sm:flex-row sm:justify-end"> <div className="flex flex-col-reverse gap-3 border-t border-grayScale-100 px-6 py-4 sm:flex-row sm:justify-end">
@ -601,7 +605,7 @@ export function UserDetailPage() {
function InfoItem({ label, value }: { label: string; value: ReactNode }) { function InfoItem({ label, value }: { label: string; value: ReactNode }) {
return ( return (
<div> <div>
<p className="mb-1 text-[11px] font-medium uppercase tracking-wider text-grayScale-400">{label}</p> <p className="mb-0.5 text-[11px] font-medium uppercase tracking-wider text-grayScale-400">{label}</p>
<p className="text-sm text-grayScale-700"> <p className="text-sm text-grayScale-700">
{typeof value === "string" && isUnassignedLabel(value) ? <UnassignedLabel /> : value} {typeof value === "string" && isUnassignedLabel(value) ? <UnassignedLabel /> : value}
</p> </p>
@ -611,9 +615,9 @@ function InfoItem({ label, value }: { label: string; value: ReactNode }) {
function InfoRow({ label, value }: { label: string; value: ReactNode }) { function InfoRow({ label, value }: { label: string; value: ReactNode }) {
return ( return (
<div className="flex items-center justify-between gap-3"> <div className="flex items-baseline gap-1.5 text-sm">
<span className="text-sm text-grayScale-500">{label}</span> <span className="shrink-0 text-grayScale-500">{label}:</span>
<span className="text-sm font-medium text-grayScale-700"> <span className="min-w-0 font-medium text-grayScale-700">
{typeof value === "string" && isUnassignedLabel(value) ? <UnassignedLabel /> : value} {typeof value === "string" && isUnassignedLabel(value) ? <UnassignedLabel /> : value}
</span> </span>
</div> </div>

View File

@ -52,6 +52,7 @@ function UserListFilterDropdown({
allLabel, allLabel,
options, options,
onSelect, onSelect,
disabled = false,
}: { }: {
id: string id: string
label: string label: string
@ -59,58 +60,69 @@ function UserListFilterDropdown({
allLabel: string allLabel: string
options: readonly string[] options: readonly string[]
onSelect: (next: string) => void onSelect: (next: string) => void
disabled?: boolean
}) { }) {
return ( return (
<div className="flex flex-col gap-1"> <div className={cn("flex flex-col gap-1", disabled && "opacity-60")}>
<label htmlFor={id} className="text-xs font-medium text-grayScale-500"> <label
htmlFor={id}
className={cn(
"text-xs font-medium text-grayScale-500",
disabled && "text-grayScale-400",
)}
>
{label} {label}
</label> </label>
<DropdownMenu.Root modal={false}> <DropdownMenu.Root modal={false}>
<DropdownMenu.Trigger asChild> <DropdownMenu.Trigger asChild disabled={disabled}>
<button <button
type="button" type="button"
id={id} id={id}
disabled={disabled}
className={cn( className={cn(
"flex h-9 w-full items-center justify-between gap-2 rounded-md border border-grayScale-200 bg-white px-3 text-left text-sm text-grayScale-600", "flex h-9 w-full items-center justify-between gap-2 rounded-md border border-grayScale-200 bg-white px-3 text-left text-sm text-grayScale-600",
"outline-none focus-visible:ring-1 focus-visible:ring-brand-500", "outline-none focus-visible:ring-1 focus-visible:ring-brand-500",
disabled && "cursor-not-allowed bg-grayScale-50 text-grayScale-400",
)} )}
> >
<span className="min-w-0 truncate">{value || allLabel}</span> <span className="min-w-0 truncate">{value || allLabel}</span>
<ChevronDown className="h-4 w-4 shrink-0 text-grayScale-400" /> <ChevronDown className="h-4 w-4 shrink-0 text-grayScale-400" />
</button> </button>
</DropdownMenu.Trigger> </DropdownMenu.Trigger>
<DropdownMenu.Portal> {!disabled ? (
<DropdownMenu.Content <DropdownMenu.Portal>
side="bottom" <DropdownMenu.Content
align="start" side="bottom"
sideOffset={4} align="start"
collisionPadding={12} sideOffset={4}
className="z-[200] max-h-60 min-w-[var(--radix-dropdown-menu-trigger-width)] overflow-y-auto rounded-md border border-grayScale-200 bg-white p-1 shadow-lg" collisionPadding={12}
onCloseAutoFocus={(e) => e.preventDefault()} className="z-[200] max-h-60 min-w-[var(--radix-dropdown-menu-trigger-width)] overflow-y-auto rounded-md border border-grayScale-200 bg-white p-1 shadow-lg"
> onCloseAutoFocus={(e) => e.preventDefault()}
<DropdownMenu.Item
className={cn(
"cursor-pointer rounded px-2 py-2 text-sm text-grayScale-700 outline-none data-[highlighted]:bg-grayScale-100",
!value && "bg-grayScale-50 font-medium",
)}
onSelect={() => onSelect("")}
> >
{allLabel}
</DropdownMenu.Item>
{options.map((opt) => (
<DropdownMenu.Item <DropdownMenu.Item
key={opt}
className={cn( className={cn(
"cursor-pointer rounded px-2 py-2 text-sm text-grayScale-700 outline-none data-[highlighted]:bg-grayScale-100", "cursor-pointer rounded px-2 py-2 text-sm text-grayScale-700 outline-none data-[highlighted]:bg-grayScale-100",
value === opt && "bg-brand-50 font-medium text-brand-700", !value && "bg-grayScale-50 font-medium",
)} )}
onSelect={() => onSelect(opt)} onSelect={() => onSelect("")}
> >
{opt} {allLabel}
</DropdownMenu.Item> </DropdownMenu.Item>
))} {options.map((opt) => (
</DropdownMenu.Content> <DropdownMenu.Item
</DropdownMenu.Portal> key={opt}
className={cn(
"cursor-pointer rounded px-2 py-2 text-sm text-grayScale-700 outline-none data-[highlighted]:bg-grayScale-100",
value === opt && "bg-brand-50 font-medium text-brand-700",
)}
onSelect={() => onSelect(opt)}
>
{opt}
</DropdownMenu.Item>
))}
</DropdownMenu.Content>
</DropdownMenu.Portal>
) : null}
</DropdownMenu.Root> </DropdownMenu.Root>
</div> </div>
) )
@ -139,7 +151,6 @@ export function UsersListPage() {
name: string name: string
nextStatus: UserStatus nextStatus: UserStatus
} | null>(null) } | null>(null)
const [roleFilter, setRoleFilter] = useState("")
const [statusFilter, setStatusFilter] = useState("") const [statusFilter, setStatusFilter] = useState("")
const [createdAfterLocal, setCreatedAfterLocal] = useState("") const [createdAfterLocal, setCreatedAfterLocal] = useState("")
const [createdBeforeLocal, setCreatedBeforeLocal] = useState("") const [createdBeforeLocal, setCreatedBeforeLocal] = useState("")
@ -171,13 +182,16 @@ export function UsersListPage() {
const res = await getUsers({ const res = await getUsers({
page, page,
page_size: pageSize, page_size: pageSize,
role: roleFilter || undefined,
status: statusFilter || undefined, status: statusFilter || undefined,
query: search || undefined, query: search || undefined,
created_after: toRfc3339FromDatetimeLocal(createdAfterLocal), created_after: toRfc3339FromDatetimeLocal(createdAfterLocal),
created_before: toRfc3339FromDatetimeLocal(createdBeforeLocal), created_before: toRfc3339FromDatetimeLocal(createdBeforeLocal),
country: countryFilter.trim() || undefined, country: countryFilter.trim() || undefined,
region: regionFilter.trim() || undefined, region:
(!countryFilter.trim() || countryFilter.trim().toLowerCase() === "ethiopia") &&
regionFilter.trim()
? regionFilter.trim()
: undefined,
subscription_status: subscriptionStatusFilter || undefined, subscription_status: subscriptionStatusFilter || undefined,
}) })
const apiUsers = res.data.data.users const apiUsers = res.data.data.users
@ -208,7 +222,6 @@ export function UsersListPage() {
}, [ }, [
page, page,
pageSize, pageSize,
roleFilter,
statusFilter, statusFilter,
search, search,
createdAfterLocal, createdAfterLocal,
@ -222,6 +235,8 @@ export function UsersListPage() {
const pageCount = Math.max(1, Math.ceil(total / pageSize)) const pageCount = Math.max(1, Math.ceil(total / pageSize))
const safePage = Math.min(page, pageCount) const safePage = Math.min(page, pageCount)
const regionFilterEnabled =
!countryFilter.trim() || countryFilter.trim().toLowerCase() === "ethiopia"
const handlePrev = () => safePage > 1 && setPage(safePage - 1) const handlePrev = () => safePage > 1 && setPage(safePage - 1)
const handleNext = () => safePage < pageCount && setPage(safePage + 1) const handleNext = () => safePage < pageCount && setPage(safePage + 1)
@ -299,7 +314,7 @@ export function UsersListPage() {
setUsers( setUsers(
users.map((user) => (user.id === id ? { ...user, status: nextStatus } : user)), users.map((user) => (user.id === id ? { ...user, status: nextStatus } : user)),
) )
toast.success(`User ${nextActive ? "activated" : "deactivated"} successfully`) toast.success(`User ${nextActive ? "activated" : "set to inactive"} successfully`)
} catch (err: any) { } catch (err: any) {
setToggledStatuses((prev) => ({ ...prev, [id]: previousActive })) setToggledStatuses((prev) => ({ ...prev, [id]: previousActive }))
notifyApiError(err, "Failed to update user status") notifyApiError(err, "Failed to update user status")
@ -318,7 +333,6 @@ export function UsersListPage() {
} }
const activeFilterCount = countActiveFilters([ const activeFilterCount = countActiveFilters([
{ value: roleFilter },
{ value: statusFilter }, { value: statusFilter },
{ value: createdAfterLocal }, { value: createdAfterLocal },
{ value: createdBeforeLocal }, { value: createdBeforeLocal },
@ -328,7 +342,6 @@ export function UsersListPage() {
]) ])
const clearFilters = () => { const clearFilters = () => {
setRoleFilter("")
setStatusFilter("") setStatusFilter("")
setCreatedAfterLocal("") setCreatedAfterLocal("")
setCreatedBeforeLocal("") setCreatedBeforeLocal("")
@ -341,17 +354,19 @@ export function UsersListPage() {
const exportParams = useMemo( const exportParams = useMemo(
() => () =>
usersExportQuery({ usersExportQuery({
role: roleFilter || undefined,
status: statusFilter || undefined, status: statusFilter || undefined,
query: search || undefined, query: search || undefined,
created_after: toRfc3339FromDatetimeLocal(createdAfterLocal), created_after: toRfc3339FromDatetimeLocal(createdAfterLocal),
created_before: toRfc3339FromDatetimeLocal(createdBeforeLocal), created_before: toRfc3339FromDatetimeLocal(createdBeforeLocal),
country: countryFilter.trim() || undefined, country: countryFilter.trim() || undefined,
region: regionFilter.trim() || undefined, region:
(!countryFilter.trim() || countryFilter.trim().toLowerCase() === "ethiopia") &&
regionFilter.trim()
? regionFilter.trim()
: undefined,
subscription_status: subscriptionStatusFilter || undefined, subscription_status: subscriptionStatusFilter || undefined,
}), }),
[ [
roleFilter,
statusFilter, statusFilter,
search, search,
createdAfterLocal, createdAfterLocal,
@ -477,22 +492,6 @@ export function UsersListPage() {
} }
> >
<div className="flex flex-wrap gap-3"> <div className="flex flex-wrap gap-3">
<div className="relative w-full sm:w-auto">
<select
value={roleFilter}
onChange={(e) => {
setRoleFilter(e.target.value)
setPage(1)
}}
className="h-9 w-full sm:w-auto appearance-none rounded-md border bg-white pl-3 pr-8 text-sm text-grayScale-600 focus:outline-none focus:ring-1 focus:ring-brand-500"
>
<option value="">All roles</option>
<option value="STUDENT">Student</option>
<option value="TEACHER">Teacher</option>
<option value="ADMIN">Admin</option>
</select>
<ChevronDown className="absolute right-2 top-1/2 h-4 w-4 -translate-y-1/2 text-grayScale-400 pointer-events-none" />
</div>
<div className="relative w-full sm:w-auto"> <div className="relative w-full sm:w-auto">
<select <select
value={statusFilter} value={statusFilter}
@ -504,9 +503,7 @@ export function UsersListPage() {
> >
<option value="">All statuses</option> <option value="">All statuses</option>
<option value="ACTIVE">Active</option> <option value="ACTIVE">Active</option>
<option value="DEACTIVATED">Deactivated</option> <option value="INACTIVE">Inactive</option>
<option value="SUSPENDED">Suspended</option>
<option value="PENDING">Pending</option>
</select> </select>
<ChevronDown className="absolute right-2 top-1/2 h-4 w-4 -translate-y-1/2 text-grayScale-400 pointer-events-none" /> <ChevronDown className="absolute right-2 top-1/2 h-4 w-4 -translate-y-1/2 text-grayScale-400 pointer-events-none" />
</div> </div>
@ -550,6 +547,9 @@ export function UsersListPage() {
options={USER_FILTER_COUNTRIES} options={USER_FILTER_COUNTRIES}
onSelect={(next) => { onSelect={(next) => {
setCountryFilter(next) setCountryFilter(next)
const allowsRegion =
!next.trim() || next.trim().toLowerCase() === "ethiopia"
if (!allowsRegion) setRegionFilter("")
setPage(1) setPage(1)
}} }}
/> />
@ -559,6 +559,7 @@ export function UsersListPage() {
value={regionFilter} value={regionFilter}
allLabel="All regions" allLabel="All regions"
options={USER_FILTER_ETHIOPIA_REGIONS} options={USER_FILTER_ETHIOPIA_REGIONS}
disabled={!regionFilterEnabled}
onSelect={(next) => { onSelect={(next) => {
setRegionFilter(next) setRegionFilter(next)
setPage(1) setPage(1)
@ -791,7 +792,10 @@ export function UsersListPage() {
<p className="text-sm leading-relaxed text-grayScale-600"> <p className="text-sm leading-relaxed text-grayScale-600">
Are you sure you want to change the status of{" "} Are you sure you want to change the status of{" "}
<span className="font-semibold">{confirmDialog.name || "this user"}</span> to{" "} <span className="font-semibold">{confirmDialog.name || "this user"}</span> to{" "}
<span className="font-semibold capitalize">{confirmDialog.nextStatus.toLowerCase()}</span>? <span className="font-semibold">
{confirmDialog.nextStatus === "DEACTIVATED" ? "Inactive" : "Active"}
</span>
?
</p> </p>
</div> </div>
<div className="flex flex-col-reverse gap-3 border-t border-grayScale-100 px-6 py-4 sm:flex-row sm:justify-end"> <div className="flex flex-col-reverse gap-3 border-t border-grayScale-100 px-6 py-4 sm:flex-row sm:justify-end">

View File

@ -144,14 +144,6 @@ export interface DashboardNotifications {
by_type: LabelCount[] by_type: LabelCount[]
} }
export interface DashboardIssues {
total_issues: number
resolved_issues: number
resolution_rate: number
by_status: LabelCount[]
by_type: LabelCount[]
}
export interface DashboardTeam { export interface DashboardTeam {
total_members: number total_members: number
by_role: LabelCount[] by_role: LabelCount[]
@ -214,7 +206,6 @@ export interface DashboardData {
courses: DashboardCourses courses: DashboardCourses
content: DashboardContent content: DashboardContent
notifications: DashboardNotifications notifications: DashboardNotifications
issues: DashboardIssues
team: DashboardTeam team: DashboardTeam
videos?: DashboardVideos videos?: DashboardVideos
} }

View File

@ -1,67 +0,0 @@
export interface Issue {
id: number;
user_id: number;
user_role: string;
subject: string;
description: string;
issue_type: string;
status: string;
metadata: Record<string, unknown> | null;
created_at: string;
updated_at: string;
}
export interface IssueListData {
issues: Issue[];
total_count: number;
}
export interface GetIssuesResponse {
message: string;
data: IssueListData;
success: boolean;
status_code: number;
metadata: null;
}
export interface GetIssueResponse {
message: string;
data: Issue;
success: boolean;
status_code: number;
metadata: null;
}
export interface CreateIssueRequest {
subject: string;
description: string;
issue_type: string;
metadata?: Record<string, unknown>;
}
export interface CreateIssueResponse {
message: string;
data: Issue;
success: boolean;
status_code: number;
metadata: unknown;
}
export interface UpdateIssueStatusResponse {
message: string;
success: boolean;
status_code: number;
metadata: null;
}
export interface DeleteIssueResponse {
message: string;
success: boolean;
status_code: number;
metadata: null;
}
export interface IssueFilters {
limit?: number;
offset?: number;
}