Skip to content

Commit 1f9d2bd

Browse files
committed
university settings link
1 parent c010cd4 commit 1f9d2bd

3 files changed

Lines changed: 33 additions & 4 deletions

File tree

apps/frontend/app/(authenticated)/account/settings/page.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use client';
22

3+
import Link from 'next/link';
34
import { Button } from '@/components/ui/button';
45
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
56
import { Input } from '@/components/ui/input';
@@ -8,6 +9,7 @@ import { useAccountSettingsForms } from '@/features/account/settings/hooks';
89
export default function AccountSettingsPage() {
910
const {
1011
user,
12+
currentOrganization,
1113
profileForm,
1214
passwordForm,
1315
updateProfileMutation,
@@ -57,6 +59,23 @@ export default function AccountSettingsPage() {
5759
</CardContent>
5860
</Card>
5961

62+
{currentOrganization && (
63+
<Card>
64+
<CardHeader>
65+
<CardTitle className='text-base'>所属大学</CardTitle>
66+
</CardHeader>
67+
<CardContent className='space-y-4'>
68+
<div>
69+
<p className='text-sm font-medium'>{currentOrganization.name}</p>
70+
<p className='text-sm text-muted-foreground'>大学のメンバーと招待を管理できます。</p>
71+
</div>
72+
<Button variant='outline' render={<Link href='/university/settings' />}>
73+
大学設定を開く
74+
</Button>
75+
</CardContent>
76+
</Card>
77+
)}
78+
6079
<Card>
6180
<CardHeader>
6281
<CardTitle className='text-base'>パスワード変更</CardTitle>

apps/frontend/app/(authenticated)/dashboard/page.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,16 @@ export default function DashboardPage() {
4141

4242
return (
4343
<div className='space-y-6'>
44-
<div>
45-
<h1 className='text-2xl font-bold'>ダッシュボード</h1>
46-
{currentOrg && <p className='text-muted-foreground mt-1'>{currentOrg.name}</p>}
44+
<div className='flex flex-wrap items-start justify-between gap-3'>
45+
<div>
46+
<h1 className='text-2xl font-bold'>ダッシュボード</h1>
47+
{currentOrg && <p className='text-muted-foreground mt-1'>{currentOrg.name}</p>}
48+
</div>
49+
{currentOrg && (
50+
<Button size='sm' variant='outline' render={<Link href='/university/settings' />}>
51+
大学設定
52+
</Button>
53+
)}
4754
</div>
4855

4956
{isLoading ? (

apps/frontend/features/account/settings/hooks.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ import { useAuth, useInvalidateMe } from '@/contexts/AuthContext';
66
import { authClient } from '@/lib/auth/client';
77

88
export function useAccountSettingsForms() {
9-
const { user } = useAuth();
9+
const { user, organizations, activeOrganizationId } = useAuth();
1010
const invalidateMe = useInvalidateMe();
11+
const currentOrganization =
12+
organizations.find((org) => org.id === activeOrganizationId) ?? organizations[0] ?? null;
1113

1214
const updateProfileMutation = useMutation({
1315
mutationFn: async (values: { name: string }) => {
@@ -61,6 +63,7 @@ export function useAccountSettingsForms() {
6163

6264
return {
6365
user,
66+
currentOrganization,
6467
profileForm,
6568
passwordForm,
6669
updateProfileMutation,

0 commit comments

Comments
 (0)