add instructor invite code..
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2026-08-07 11:57:38 +09:00
parent d746d9d0dc
commit b65781fd55
4 changed files with 44 additions and 1 deletions
+33 -1
View File
@@ -13,6 +13,7 @@ import {
lockUser,
terminateUserSession,
unlockUser,
updateLmsInstructor,
type LicensePlan,
type Organization,
type UserSession
@@ -45,6 +46,7 @@ export function UserSessionsPage() {
const [createSaving, setCreateSaving] = useState(false);
const [menuSession, setMenuSession] = useState<{ id: string; x: number; y: number } | null>(null);
const [detailSession, setDetailSession] = useState<UserSession | null>(null);
const [lmsRoleSaving, setLmsRoleSaving] = useState(false);
const loadingVisible = useMinimumLoading(loading);
const refresh = () => {
@@ -183,6 +185,24 @@ export function UserSessionsPage() {
.finally(() => setCreateSaving(false));
};
const setLmsInstructor = (isInstructor: boolean) => {
if (!detailSession) return;
setLmsRoleSaving(true);
updateLmsInstructor(detailSession.userId, isInstructor)
.then(() => {
setDetailSession((current) => current ? { ...current, isLmsInstructor: isInstructor } : current);
setSessions((current) => current.map((session) => (
session.userId === detailSession.userId ? { ...session, isLmsInstructor: isInstructor } : session
)));
toast({ type: 'success', title: 'LMS 역할 변경', message: isInstructor ? '강사 권한을 부여했습니다.' : '강사 권한을 해제했습니다.' });
})
.catch((error: Error) => {
toast({ type: 'error', title: 'LMS 역할 변경 실패', message: error.message });
})
.finally(() => setLmsRoleSaving(false));
};
return (
<>
<PageTitle
@@ -289,8 +309,20 @@ export function UserSessionsPage() {
</div>
<StatusBadge status={detailSession.state} />
</div>
<div className="grid gap-3 text-sm">
<div className="grid gap-3 text-sm sm:grid-cols-2">
<DetailItem label="사용자 ID" value={detailSession.userId} mono />
<label className="block min-w-0">
<span className="text-xs font-medium text-muted-foreground">LMS</span>
<select
className="mt-2 h-9 w-full rounded-md border border-input bg-background px-3 text-sm font-medium text-foreground outline-none focus:ring-2 focus:ring-ring"
value={detailSession.isLmsInstructor ? 'INSTRUCTOR' : 'STUDENT'}
disabled={lmsRoleSaving}
onChange={(event) => setLmsInstructor(event.target.value === 'INSTRUCTOR')}
>
<option value="STUDENT">수강생</option>
<option value="INSTRUCTOR">강사</option>
</select>
</label>
<DetailItem label="조직" value={detailSession.primaryAffiliation?.organizationName ?? '-'} />
<DetailItem label="조직 유형" value={organizationTypeLabel(detailSession.primaryAffiliation?.organizationType)} />
<DetailItem label="부서" value={detailSession.primaryAffiliation?.department ?? '-'} />