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:
parent
992ca85690
commit
13217ae6b5
|
|
@ -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}`);
|
||||
|
|
@ -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 {
|
||||
page?: number
|
||||
page_size?: number
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@ import { AddQuestionPage } from "../pages/content-management/AddQuestionPage";
|
|||
import { HumanLanguageHierarchyPage } from "../pages/content-management/HumanLanguageHierarchyPage";
|
||||
import { HumanLanguageSubModulePage } from "../pages/content-management/HumanLanguageSubModulePage";
|
||||
import { UserLogPage } from "../pages/user-log/UserLogPage";
|
||||
import { IssuesPage } from "../pages/issues/IssuesPage";
|
||||
import { PaymentsPage } from "../pages/payments/PaymentsPage";
|
||||
import { SubscriptionsExportPage } from "../pages/subscriptions/SubscriptionsExportPage";
|
||||
import { ProfilePage } from "../pages/ProfilePage";
|
||||
|
|
@ -347,7 +346,6 @@ export function AppRoutes() {
|
|||
<Route path="/payments" element={<PaymentsPage />} />
|
||||
<Route path="/subscriptions/export" element={<SubscriptionsExportPage />} />
|
||||
<Route path="/user-log" element={<UserLogPage />} />
|
||||
<Route path="/issues" element={<IssuesPage />} />
|
||||
<Route path="/help/faqs" element={<FaqsPage />} />
|
||||
<Route path="/help/faqs/:id/edit" element={<EditFaqPage />} />
|
||||
<Route path="/app-reviews" element={<AppReviewsPage />} />
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import {
|
|||
BookOpen,
|
||||
ChevronLeft,
|
||||
ChevronRight,
|
||||
CircleAlert,
|
||||
CircleHelp,
|
||||
ClipboardList,
|
||||
CreditCard,
|
||||
|
|
@ -126,7 +125,6 @@ const navEntries: NavEntry[] = [
|
|||
icon: ClipboardList,
|
||||
permission: "activity_logs.list",
|
||||
},
|
||||
{ kind: "link", label: "Issue reports", to: "/issues", icon: CircleAlert },
|
||||
{
|
||||
kind: "link",
|
||||
label: "FAQs",
|
||||
|
|
|
|||
|
|
@ -236,7 +236,6 @@ export const RESOURCE_TYPE_OPTIONS: { value: string; label: string }[] = [
|
|||
{ value: "FILE", label: "File" },
|
||||
{ value: "REFERRAL", label: "Referral" },
|
||||
{ value: "ASSESSMENT_QUESTION", label: "Assessment question" },
|
||||
{ value: "ISSUE", label: "Issue" },
|
||||
{ value: "RATING", label: "Rating" },
|
||||
]
|
||||
|
||||
|
|
@ -353,8 +352,6 @@ export function activityLogResourcePath(
|
|||
return `/notifications/email-templates`
|
||||
case "SUBSCRIPTION_PLAN":
|
||||
return `/settings`
|
||||
case "ISSUE":
|
||||
return `/issues`
|
||||
default:
|
||||
return null
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import {
|
|||
HelpCircle,
|
||||
MessageSquare,
|
||||
Star,
|
||||
TicketCheck,
|
||||
// TrendingUp,
|
||||
Users,
|
||||
UserX,
|
||||
|
|
@ -179,12 +178,6 @@ export function DashboardPage() {
|
|||
dashboard?.subscriptions.by_status,
|
||||
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 subscriptionMetrics = dashboard
|
||||
|
|
@ -306,13 +299,6 @@ export function DashboardPage() {
|
|||
deltaLabel={`${dashboard.payments.total_payments} payments`}
|
||||
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>
|
||||
)}
|
||||
|
||||
|
|
@ -499,13 +485,6 @@ export function DashboardPage() {
|
|||
countSuffix="Subscriptions"
|
||||
/>
|
||||
) : null}
|
||||
{issueStatusData.length > 0 ? (
|
||||
<DonutBreakdownCard
|
||||
title="Issue Status"
|
||||
data={issueStatusData}
|
||||
countSuffix="Issues"
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import {
|
|||
BookOpen,
|
||||
HelpCircle,
|
||||
Bell,
|
||||
TicketCheck,
|
||||
UsersRound,
|
||||
TrendingUp,
|
||||
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 seriesPeriodLabel = getSeriesPeriodLabel(dashboard.date_filter)
|
||||
const lms = courses.lms
|
||||
|
|
@ -521,12 +520,6 @@ export function AnalyticsPage() {
|
|||
? aggregateRevenueByMonth(payments.revenue_last_30_days, monthlyTrendYear)
|
||||
: 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(
|
||||
subscriptions.by_status,
|
||||
PIE_COLORS,
|
||||
|
|
@ -668,13 +661,6 @@ export function AnalyticsPage() {
|
|||
}
|
||||
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>
|
||||
</Section>
|
||||
</>
|
||||
|
|
@ -1194,20 +1180,6 @@ export function AnalyticsPage() {
|
|||
</div>
|
||||
</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 ─── */}
|
||||
<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">
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -64,6 +64,8 @@ function formatRoleLabel(role: string): string {
|
|||
function formatStatusLabel(status: string): string {
|
||||
const value = status.trim();
|
||||
if (!value) return NOT_ASSIGNED_LABEL;
|
||||
const normalized = value.toUpperCase();
|
||||
if (normalized === "DEACTIVATED") return "Inactive";
|
||||
return value
|
||||
.split("_")
|
||||
.map((part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase())
|
||||
|
|
@ -288,7 +290,7 @@ export function UserDetailPage() {
|
|||
setUser((prev) => (prev ? { ...prev, status: nextStatus } : prev));
|
||||
try {
|
||||
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) {
|
||||
setUser((prev) => (prev ? { ...prev, status: previousStatus } : prev));
|
||||
notifyApiError(err, "Failed to update user status");
|
||||
|
|
@ -399,10 +401,10 @@ export function UserDetailPage() {
|
|||
<Icon className="h-4 w-4 text-grayScale-400" />
|
||||
</div>
|
||||
<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}
|
||||
</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>
|
||||
))}
|
||||
|
|
@ -414,7 +416,6 @@ export function UserDetailPage() {
|
|||
<InfoRow label="Joined" value={formatDate(user.created_at)} />
|
||||
<InfoRow label="Last login" value={formatDateTime(user.last_login, "Never")} />
|
||||
<InfoRow label="Gender" value={<DisplayValue value={user.gender} />} />
|
||||
<InfoRow label="Birthday" value={formatDate(user.birth_day)} />
|
||||
<InfoRow label="Occupation" value={<DisplayValue value={user.occupation} />} />
|
||||
</div>
|
||||
</CardContent>
|
||||
|
|
@ -466,7 +467,7 @@ export function UserDetailPage() {
|
|||
</div>
|
||||
</CardHeader>
|
||||
<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="Age group" value={formatAgeGroup(user.age_group)} />
|
||||
<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">
|
||||
Are you sure you want to change the status of{" "}
|
||||
<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>
|
||||
</div>
|
||||
<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 }) {
|
||||
return (
|
||||
<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">
|
||||
{typeof value === "string" && isUnassignedLabel(value) ? <UnassignedLabel /> : value}
|
||||
</p>
|
||||
|
|
@ -611,9 +615,9 @@ function InfoItem({ label, value }: { label: string; value: ReactNode }) {
|
|||
|
||||
function InfoRow({ label, value }: { label: string; value: ReactNode }) {
|
||||
return (
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<span className="text-sm text-grayScale-500">{label}</span>
|
||||
<span className="text-sm font-medium text-grayScale-700">
|
||||
<div className="flex items-baseline gap-1.5 text-sm">
|
||||
<span className="shrink-0 text-grayScale-500">{label}:</span>
|
||||
<span className="min-w-0 font-medium text-grayScale-700">
|
||||
{typeof value === "string" && isUnassignedLabel(value) ? <UnassignedLabel /> : value}
|
||||
</span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ function UserListFilterDropdown({
|
|||
allLabel,
|
||||
options,
|
||||
onSelect,
|
||||
disabled = false,
|
||||
}: {
|
||||
id: string
|
||||
label: string
|
||||
|
|
@ -59,58 +60,69 @@ function UserListFilterDropdown({
|
|||
allLabel: string
|
||||
options: readonly string[]
|
||||
onSelect: (next: string) => void
|
||||
disabled?: boolean
|
||||
}) {
|
||||
return (
|
||||
<div className="flex flex-col gap-1">
|
||||
<label htmlFor={id} className="text-xs font-medium text-grayScale-500">
|
||||
<div className={cn("flex flex-col gap-1", disabled && "opacity-60")}>
|
||||
<label
|
||||
htmlFor={id}
|
||||
className={cn(
|
||||
"text-xs font-medium text-grayScale-500",
|
||||
disabled && "text-grayScale-400",
|
||||
)}
|
||||
>
|
||||
{label}
|
||||
</label>
|
||||
<DropdownMenu.Root modal={false}>
|
||||
<DropdownMenu.Trigger asChild>
|
||||
<DropdownMenu.Trigger asChild disabled={disabled}>
|
||||
<button
|
||||
type="button"
|
||||
id={id}
|
||||
disabled={disabled}
|
||||
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",
|
||||
"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>
|
||||
<ChevronDown className="h-4 w-4 shrink-0 text-grayScale-400" />
|
||||
</button>
|
||||
</DropdownMenu.Trigger>
|
||||
<DropdownMenu.Portal>
|
||||
<DropdownMenu.Content
|
||||
side="bottom"
|
||||
align="start"
|
||||
sideOffset={4}
|
||||
collisionPadding={12}
|
||||
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("")}
|
||||
{!disabled ? (
|
||||
<DropdownMenu.Portal>
|
||||
<DropdownMenu.Content
|
||||
side="bottom"
|
||||
align="start"
|
||||
sideOffset={4}
|
||||
collisionPadding={12}
|
||||
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()}
|
||||
>
|
||||
{allLabel}
|
||||
</DropdownMenu.Item>
|
||||
{options.map((opt) => (
|
||||
<DropdownMenu.Item
|
||||
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",
|
||||
!value && "bg-grayScale-50 font-medium",
|
||||
)}
|
||||
onSelect={() => onSelect(opt)}
|
||||
onSelect={() => onSelect("")}
|
||||
>
|
||||
{opt}
|
||||
{allLabel}
|
||||
</DropdownMenu.Item>
|
||||
))}
|
||||
</DropdownMenu.Content>
|
||||
</DropdownMenu.Portal>
|
||||
{options.map((opt) => (
|
||||
<DropdownMenu.Item
|
||||
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>
|
||||
</div>
|
||||
)
|
||||
|
|
@ -139,7 +151,6 @@ export function UsersListPage() {
|
|||
name: string
|
||||
nextStatus: UserStatus
|
||||
} | null>(null)
|
||||
const [roleFilter, setRoleFilter] = useState("")
|
||||
const [statusFilter, setStatusFilter] = useState("")
|
||||
const [createdAfterLocal, setCreatedAfterLocal] = useState("")
|
||||
const [createdBeforeLocal, setCreatedBeforeLocal] = useState("")
|
||||
|
|
@ -171,13 +182,16 @@ export function UsersListPage() {
|
|||
const res = await getUsers({
|
||||
page,
|
||||
page_size: pageSize,
|
||||
role: roleFilter || undefined,
|
||||
status: statusFilter || undefined,
|
||||
query: search || undefined,
|
||||
created_after: toRfc3339FromDatetimeLocal(createdAfterLocal),
|
||||
created_before: toRfc3339FromDatetimeLocal(createdBeforeLocal),
|
||||
country: countryFilter.trim() || undefined,
|
||||
region: regionFilter.trim() || undefined,
|
||||
region:
|
||||
(!countryFilter.trim() || countryFilter.trim().toLowerCase() === "ethiopia") &&
|
||||
regionFilter.trim()
|
||||
? regionFilter.trim()
|
||||
: undefined,
|
||||
subscription_status: subscriptionStatusFilter || undefined,
|
||||
})
|
||||
const apiUsers = res.data.data.users
|
||||
|
|
@ -208,7 +222,6 @@ export function UsersListPage() {
|
|||
}, [
|
||||
page,
|
||||
pageSize,
|
||||
roleFilter,
|
||||
statusFilter,
|
||||
search,
|
||||
createdAfterLocal,
|
||||
|
|
@ -222,6 +235,8 @@ export function UsersListPage() {
|
|||
|
||||
const pageCount = Math.max(1, Math.ceil(total / pageSize))
|
||||
const safePage = Math.min(page, pageCount)
|
||||
const regionFilterEnabled =
|
||||
!countryFilter.trim() || countryFilter.trim().toLowerCase() === "ethiopia"
|
||||
|
||||
const handlePrev = () => safePage > 1 && setPage(safePage - 1)
|
||||
const handleNext = () => safePage < pageCount && setPage(safePage + 1)
|
||||
|
|
@ -299,7 +314,7 @@ export function UsersListPage() {
|
|||
setUsers(
|
||||
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) {
|
||||
setToggledStatuses((prev) => ({ ...prev, [id]: previousActive }))
|
||||
notifyApiError(err, "Failed to update user status")
|
||||
|
|
@ -318,7 +333,6 @@ export function UsersListPage() {
|
|||
}
|
||||
|
||||
const activeFilterCount = countActiveFilters([
|
||||
{ value: roleFilter },
|
||||
{ value: statusFilter },
|
||||
{ value: createdAfterLocal },
|
||||
{ value: createdBeforeLocal },
|
||||
|
|
@ -328,7 +342,6 @@ export function UsersListPage() {
|
|||
])
|
||||
|
||||
const clearFilters = () => {
|
||||
setRoleFilter("")
|
||||
setStatusFilter("")
|
||||
setCreatedAfterLocal("")
|
||||
setCreatedBeforeLocal("")
|
||||
|
|
@ -341,17 +354,19 @@ export function UsersListPage() {
|
|||
const exportParams = useMemo(
|
||||
() =>
|
||||
usersExportQuery({
|
||||
role: roleFilter || undefined,
|
||||
status: statusFilter || undefined,
|
||||
query: search || undefined,
|
||||
created_after: toRfc3339FromDatetimeLocal(createdAfterLocal),
|
||||
created_before: toRfc3339FromDatetimeLocal(createdBeforeLocal),
|
||||
country: countryFilter.trim() || undefined,
|
||||
region: regionFilter.trim() || undefined,
|
||||
region:
|
||||
(!countryFilter.trim() || countryFilter.trim().toLowerCase() === "ethiopia") &&
|
||||
regionFilter.trim()
|
||||
? regionFilter.trim()
|
||||
: undefined,
|
||||
subscription_status: subscriptionStatusFilter || undefined,
|
||||
}),
|
||||
[
|
||||
roleFilter,
|
||||
statusFilter,
|
||||
search,
|
||||
createdAfterLocal,
|
||||
|
|
@ -477,22 +492,6 @@ export function UsersListPage() {
|
|||
}
|
||||
>
|
||||
<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">
|
||||
<select
|
||||
value={statusFilter}
|
||||
|
|
@ -504,9 +503,7 @@ export function UsersListPage() {
|
|||
>
|
||||
<option value="">All statuses</option>
|
||||
<option value="ACTIVE">Active</option>
|
||||
<option value="DEACTIVATED">Deactivated</option>
|
||||
<option value="SUSPENDED">Suspended</option>
|
||||
<option value="PENDING">Pending</option>
|
||||
<option value="INACTIVE">Inactive</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>
|
||||
|
|
@ -550,6 +547,9 @@ export function UsersListPage() {
|
|||
options={USER_FILTER_COUNTRIES}
|
||||
onSelect={(next) => {
|
||||
setCountryFilter(next)
|
||||
const allowsRegion =
|
||||
!next.trim() || next.trim().toLowerCase() === "ethiopia"
|
||||
if (!allowsRegion) setRegionFilter("")
|
||||
setPage(1)
|
||||
}}
|
||||
/>
|
||||
|
|
@ -559,6 +559,7 @@ export function UsersListPage() {
|
|||
value={regionFilter}
|
||||
allLabel="All regions"
|
||||
options={USER_FILTER_ETHIOPIA_REGIONS}
|
||||
disabled={!regionFilterEnabled}
|
||||
onSelect={(next) => {
|
||||
setRegionFilter(next)
|
||||
setPage(1)
|
||||
|
|
@ -791,7 +792,10 @@ export function UsersListPage() {
|
|||
<p className="text-sm leading-relaxed text-grayScale-600">
|
||||
Are you sure you want to change the status of{" "}
|
||||
<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>
|
||||
</div>
|
||||
<div className="flex flex-col-reverse gap-3 border-t border-grayScale-100 px-6 py-4 sm:flex-row sm:justify-end">
|
||||
|
|
|
|||
|
|
@ -144,14 +144,6 @@ export interface DashboardNotifications {
|
|||
by_type: LabelCount[]
|
||||
}
|
||||
|
||||
export interface DashboardIssues {
|
||||
total_issues: number
|
||||
resolved_issues: number
|
||||
resolution_rate: number
|
||||
by_status: LabelCount[]
|
||||
by_type: LabelCount[]
|
||||
}
|
||||
|
||||
export interface DashboardTeam {
|
||||
total_members: number
|
||||
by_role: LabelCount[]
|
||||
|
|
@ -214,7 +206,6 @@ export interface DashboardData {
|
|||
courses: DashboardCourses
|
||||
content: DashboardContent
|
||||
notifications: DashboardNotifications
|
||||
issues: DashboardIssues
|
||||
team: DashboardTeam
|
||||
videos?: DashboardVideos
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user