Compare commits

..

No commits in common. "00bb1a46dc510a7a1d2f18fea130f3093ede3616" and "978d74d226bf7535809774afe01a4602f338030f" have entirely different histories.

5 changed files with 27 additions and 5 deletions

View File

@ -10,10 +10,11 @@ type CardReportProperty = {
properties: React.JSX.IntrinsicAttributes & React.SVGProps<SVGSVGElement>,
) => JSX.Element
url?: string
counter?: number[]
}
export const CardReport = (properties: CardReportProperty) => {
const { title, amount, icon: Icon, currency } = properties
const { title, amount, icon: Icon, counter, currency } = properties
return (
<div className="rounded-xl bg-white px-4 py-6 shadow-sm">
<div className="flex items-center">
@ -31,6 +32,11 @@ export const CardReport = (properties: CardReportProperty) => {
</p>
</div>
</div>
{counter?.length && (
<div className="flex items-center pt-2">
Pribadi: {counter[0]} | Perusahaan: {counter[1]}
</div>
)}
</div>
)
}

View File

@ -45,6 +45,10 @@ export const UsersPage = () => {
title: 'Email',
data: 'email',
},
{
title: 'Kategori',
data: 'subscribe.status',
},
{
title: 'Status',
data: 'subscribe.subscribe_plan.name',
@ -58,7 +62,8 @@ export const UsersPage = () => {
<div className="text-sm text-[#7C7C7C]">ID: {data.id.slice(0, 8)}</div>
</div>
),
4: (value: TColorBadge, _type: unknown, data: TUserResponse) => (
4: (_value: string) => <span className="text-sm">Pribadi</span>,
5: (value: TColorBadge, _type: unknown, data: TUserResponse) => (
<span
className={`rounded-lg px-2 text-sm ${getStatusBadge(data.subscribe.status as TColorBadge)}`}
>

View File

@ -17,10 +17,12 @@ export const HISTORY = [
title: 'Total Content Biasa',
amount: 2890,
icon: GraphIcon,
counter: [2190, 700],
},
{
title: 'Total Content Premium',
amount: 274,
icon: DoctorIcon,
counter: [211, 54],
},
]

View File

@ -34,12 +34,13 @@ export const DashboardPage = () => {
</div>
<div className="mt-5 grid grid-cols-1 gap-6 sm:grid-cols-3 sm:grid-rows-2">
{HISTORY.map(({ title, amount, icon }, index) => (
{HISTORY.map(({ title, amount, icon, counter }, index) => (
<CardReport
key={index}
title={title}
amount={amount}
icon={icon}
counter={counter}
/>
))}
<div className="max-h-[300px] sm:col-span-2 sm:col-start-2 sm:row-span-2 sm:row-start-1">

View File

@ -1,9 +1,11 @@
import { isRouteErrorResponse, Outlet, redirect } from 'react-router'
import { XiorError } from 'xior'
import { getStaff } from '~/apis/admin/get-staff'
import { AUTH_PAGES } from '~/configs/pages'
import { AdminDefaultLayout } from '~/layouts/admin/default'
import { handleCookie } from '~/libs/cookies'
import { setStaffLogoutHeaders } from '~/libs/logout-header.server'
import type { Route } from './+types/_admin.lg-admin'
@ -14,8 +16,14 @@ export const loader = async ({ request }: Route.LoaderArgs) => {
let staffData
if (accessToken) {
const { data } = await getStaff({ accessToken })
staffData = data
try {
const { data } = await getStaff({ accessToken })
staffData = data
} catch (error) {
if (error instanceof XiorError && error.response?.status === 401) {
setStaffLogoutHeaders()
}
}
}
if (!isAuthPage && !accessToken) {