style: format profile page code and update input placeholder
This commit is contained in:
@@ -1,7 +1,14 @@
|
||||
'use client'
|
||||
|
||||
import { useEffect, useState } from 'react'
|
||||
import { getSessionUser, updateProfile, changePassword, getSettings, getUserNotificationConfig, updateUserNotificationConfig } from '@/app/actions'
|
||||
import {
|
||||
getSessionUser,
|
||||
updateProfile,
|
||||
changePassword,
|
||||
getSettings,
|
||||
getUserNotificationConfig,
|
||||
updateUserNotificationConfig,
|
||||
} from '@/app/actions'
|
||||
import { Card, CardContent, CardHeader, CardTitle, CardFooter } from '@/components/ui/card'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
@@ -65,7 +72,7 @@ export default function ProfilePage() {
|
||||
|
||||
const [globalSettings, notifConfig] = await Promise.all([
|
||||
getSettings(),
|
||||
getUserNotificationConfig(sessionUser.id)
|
||||
getUserNotificationConfig(sessionUser.id),
|
||||
])
|
||||
|
||||
if (globalSettings?.MATTERMOST_NOTIF_ENABLED === 'true') {
|
||||
@@ -93,10 +100,12 @@ export default function ProfilePage() {
|
||||
|
||||
const [res, notifRes] = await Promise.all([
|
||||
updateProfile(user.id, name.trim(), photo.trim() || null),
|
||||
globalNotifEnabled ? updateUserNotificationConfig(user.id, {
|
||||
mattermost_channel_id: mmChannelId,
|
||||
is_active: mmActive
|
||||
}) : Promise.resolve({ success: true, error: null })
|
||||
globalNotifEnabled
|
||||
? updateUserNotificationConfig(user.id, {
|
||||
mattermost_channel_id: mmChannelId,
|
||||
is_active: mmActive,
|
||||
})
|
||||
: Promise.resolve({ success: true, error: null }),
|
||||
])
|
||||
|
||||
if (res.success && notifRes.success) {
|
||||
@@ -244,7 +253,7 @@ export default function ProfilePage() {
|
||||
</div>
|
||||
|
||||
{globalNotifEnabled && (
|
||||
<div className="space-y-6 pt-6 mt-6 border-t border-slate-100 dark:border-slate-800">
|
||||
<div className="mt-6 space-y-6 border-t border-slate-100 pt-6 dark:border-slate-800">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-purple-100 text-purple-600 dark:bg-purple-900/30 dark:text-purple-400">
|
||||
<MessageCircle className="h-5 w-5" />
|
||||
@@ -259,7 +268,7 @@ export default function ProfilePage() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-row items-start space-x-3 space-y-0 rounded-md border border-slate-200 p-4 dark:border-slate-800">
|
||||
<div className="flex flex-row items-start space-y-0 space-x-3 rounded-md border border-slate-200 p-4 dark:border-slate-800">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="mmActive"
|
||||
@@ -278,14 +287,17 @@ export default function ProfilePage() {
|
||||
</div>
|
||||
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor="mm-channel" className="text-xs font-bold tracking-wider text-slate-700 uppercase dark:text-slate-300">
|
||||
<Label
|
||||
htmlFor="mm-channel"
|
||||
className="text-xs font-bold tracking-wider text-slate-700 uppercase dark:text-slate-300"
|
||||
>
|
||||
Username / Channel ID
|
||||
</Label>
|
||||
<Input
|
||||
id="mm-channel"
|
||||
value={mmChannelId}
|
||||
onChange={(e) => setMmChannelId(e.target.value)}
|
||||
placeholder="Contoh: @firman atau 9dpxnitm..."
|
||||
placeholder="Contoh: budisantoso atau 9dpxnitm..."
|
||||
className="h-11 rounded-xl"
|
||||
/>
|
||||
</div>
|
||||
@@ -321,7 +333,6 @@ export default function ProfilePage() {
|
||||
</div>
|
||||
</form>
|
||||
</Card>
|
||||
|
||||
</div>
|
||||
|
||||
{/* Right 1 Col: Account Details */}
|
||||
|
||||
Reference in New Issue
Block a user