This commit is contained in:
parent
c0ae6cc9a0
commit
3bf1b67256
1 changed files with 75 additions and 70 deletions
145
app/me/page.tsx
145
app/me/page.tsx
|
|
@ -157,67 +157,74 @@ export default function ProfilePage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="panel" style={{ maxWidth: 640, margin: '40px auto' }}>
|
<main style={{ maxWidth: 1040, margin: '32px auto', display: 'grid', gap: 18 }}>
|
||||||
<h1>{t('myProfileTitle')}</h1>
|
<header className="panel" style={{ display: 'grid', gap: 12, padding: 18 }}>
|
||||||
{message ? <p style={{ color: 'green' }}>{message}</p> : null}
|
<div>
|
||||||
|
<h1 style={{ margin: 0 }}>{t('myProfileTitle')}</h1>
|
||||||
|
{message ? <p style={{ color: 'green', margin: '6px 0 0' }}>{message}</p> : null}
|
||||||
|
</div>
|
||||||
|
{user ? (
|
||||||
|
<>
|
||||||
|
<div style={{ display: 'grid', gap: 6, gridTemplateColumns: 'repeat(auto-fit, minmax(220px, 1fr))' }}>
|
||||||
|
<div><strong>{t('profileEmail')}:</strong> {user.email}</div>
|
||||||
|
<div><strong>{t('profileName')}:</strong> {user.name ?? '—'}</div>
|
||||||
|
<div><strong>{t('profilePhone')}:</strong> {user.phone ?? '—'}</div>
|
||||||
|
<div><strong>{t('profileRole')}:</strong> {user.role}</div>
|
||||||
|
<div><strong>{t('profileStatus')}:</strong> {user.status}</div>
|
||||||
|
<div><strong>{t('profileEmailVerified')}:</strong> {user.emailVerifiedAt ? t('yes') : t('no')}</div>
|
||||||
|
<div><strong>{t('profileApproved')}:</strong> {user.approvedAt ? t('yes') : t('no')}</div>
|
||||||
|
</div>
|
||||||
|
<div style={{ display: 'flex', gap: 10, flexWrap: 'wrap' }}>
|
||||||
|
<a className="button secondary" href="/listings/mine">
|
||||||
|
{t('navMyListings')}
|
||||||
|
</a>
|
||||||
|
<a className="button secondary" href="/listings/new">
|
||||||
|
{t('navNewListing')}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<p style={{ color: 'red', margin: 0 }}>{error ?? t('notLoggedIn')}</p>
|
||||||
|
)}
|
||||||
|
</header>
|
||||||
|
|
||||||
{user ? (
|
{user ? (
|
||||||
<>
|
<>
|
||||||
<ul>
|
<section className="panel" style={{ padding: 18, display: 'grid', gap: 12 }}>
|
||||||
<li>
|
<h2 style={{ margin: 0 }}>{t('myProfileTitle')}</h2>
|
||||||
<strong>{t('profileEmail')}:</strong> {user.email}
|
<form onSubmit={onSave} style={{ display: 'grid', gap: 12 }}>
|
||||||
</li>
|
<div style={{ display: 'grid', gap: 10, gridTemplateColumns: 'repeat(auto-fit, minmax(260px, 1fr))', maxWidth: 760 }}>
|
||||||
<li>
|
<label>
|
||||||
<strong>{t('profileName')}:</strong> {user.name ?? '—'}
|
{t('profileName')}
|
||||||
</li>
|
<input value={name} onChange={(e) => setName(e.target.value)} />
|
||||||
<li>
|
</label>
|
||||||
<strong>{t('profilePhone')}:</strong> {user.phone ?? '—'}
|
<label>
|
||||||
</li>
|
{t('profilePhone')}
|
||||||
<li>
|
<input value={phone} onChange={(e) => setPhone(e.target.value)} />
|
||||||
<strong>{t('profileRole')}:</strong> {user.role}
|
</label>
|
||||||
</li>
|
<label>
|
||||||
<li>
|
{t('passwordLabel')} ({t('passwordHint')})
|
||||||
<strong>{t('profileStatus')}:</strong> {user.status}
|
<input type="password" value={password} onChange={(e) => setPassword(e.target.value)} minLength={8} />
|
||||||
</li>
|
</label>
|
||||||
<li>
|
</div>
|
||||||
<strong>{t('profileEmailVerified')}:</strong> {user.emailVerifiedAt ? t('yes') : t('no')}
|
<p style={{ fontSize: 12, color: '#666', margin: 0 }}>{t('emailLocked')}</p>
|
||||||
</li>
|
<div>
|
||||||
<li>
|
<button className="button" type="submit" disabled={saving} style={{ minWidth: 160 }}>
|
||||||
<strong>{t('profileApproved')}:</strong> {user.approvedAt ? t('yes') : t('no')}
|
{saving ? t('saving') : t('save')}
|
||||||
</li>
|
</button>
|
||||||
</ul>
|
</div>
|
||||||
<div style={{ marginTop: 16, display: 'flex', gap: 10, flexWrap: 'wrap' }}>
|
</form>
|
||||||
<a className="button secondary" href="/listings/mine">
|
</section>
|
||||||
{t('navMyListings')}
|
|
||||||
</a>
|
<section className="panel" style={{ padding: 18, display: 'grid', gap: 12 }}>
|
||||||
<a className="button secondary" href="/listings/new">
|
<div>
|
||||||
{t('navNewListing')}
|
<h2 style={{ margin: 0 }}>{t('billingSettingsTitle')}</h2>
|
||||||
</a>
|
<p style={{ color: '#444', margin: '6px 0 0' }}>{t('billingSettingsLead')}</p>
|
||||||
</div>
|
</div>
|
||||||
<form onSubmit={onSave} style={{ marginTop: 20, display: 'grid', gap: 10, maxWidth: 420 }}>
|
{billingMessage ? <p style={{ color: 'green', margin: 0 }}>{billingMessage}</p> : null}
|
||||||
<label>
|
{billingError ? <p style={{ color: 'red', margin: 0 }}>{billingError}</p> : null}
|
||||||
{t('profileName')}
|
<form onSubmit={onSaveBilling} style={{ display: 'grid', gap: 14 }}>
|
||||||
<input value={name} onChange={(e) => setName(e.target.value)} />
|
<label className="amenity-option" style={{ maxWidth: 520, alignItems: 'center' }}>
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
{t('profilePhone')}
|
|
||||||
<input value={phone} onChange={(e) => setPhone(e.target.value)} />
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
{t('passwordLabel')} ({t('passwordHint')})
|
|
||||||
<input type="password" value={password} onChange={(e) => setPassword(e.target.value)} minLength={8} />
|
|
||||||
</label>
|
|
||||||
<p style={{ fontSize: 12, color: '#666' }}>{t('emailLocked')}</p>
|
|
||||||
<button className="button" type="submit" disabled={saving}>
|
|
||||||
{saving ? t('saving') : t('save')}
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
<section style={{ marginTop: 30 }}>
|
|
||||||
<h2 style={{ marginBottom: 6 }}>{t('billingSettingsTitle')}</h2>
|
|
||||||
<p style={{ color: '#444', marginBottom: 12 }}>{t('billingSettingsLead')}</p>
|
|
||||||
{billingMessage ? <p style={{ color: 'green' }}>{billingMessage}</p> : null}
|
|
||||||
{billingError ? <p style={{ color: 'red' }}>{billingError}</p> : null}
|
|
||||||
<form onSubmit={onSaveBilling} style={{ display: 'grid', gap: 14, marginTop: 8 }}>
|
|
||||||
<label className="amenity-option" style={{ maxWidth: 460, alignItems: 'center' }}>
|
|
||||||
<div className="amenity-option-meta" style={{ fontWeight: 600 }}>
|
<div className="amenity-option-meta" style={{ fontWeight: 600 }}>
|
||||||
<span className="amenity-name">{t('billingEnableLabel')}</span>
|
<span className="amenity-name">{t('billingEnableLabel')}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -230,7 +237,7 @@ export default function ProfilePage() {
|
||||||
</label>
|
</label>
|
||||||
{billingEnabled ? (
|
{billingEnabled ? (
|
||||||
<>
|
<>
|
||||||
<div style={{ display: 'grid', gap: 8 }}>
|
<div style={{ display: 'grid', gap: 10, gridTemplateColumns: 'repeat(auto-fit, minmax(260px, 1fr))', maxWidth: 760 }}>
|
||||||
<label>
|
<label>
|
||||||
{t('billingAccountNameLabel')}
|
{t('billingAccountNameLabel')}
|
||||||
<input value={billingAccountName} onChange={(e) => setBillingAccountName(e.target.value)} placeholder="Example Oy" />
|
<input value={billingAccountName} onChange={(e) => setBillingAccountName(e.target.value)} placeholder="Example Oy" />
|
||||||
|
|
@ -239,7 +246,7 @@ export default function ProfilePage() {
|
||||||
{t('billingIbanLabel')}
|
{t('billingIbanLabel')}
|
||||||
<input value={billingIban} onChange={(e) => setBillingIban(e.target.value)} placeholder="FI00 1234 5600 0007 85" />
|
<input value={billingIban} onChange={(e) => setBillingIban(e.target.value)} placeholder="FI00 1234 5600 0007 85" />
|
||||||
</label>
|
</label>
|
||||||
<label className="amenity-option" style={{ maxWidth: 460, alignItems: 'center' }}>
|
<label className="amenity-option" style={{ maxWidth: 520, alignItems: 'center' }}>
|
||||||
<div className="amenity-option-meta" style={{ fontWeight: 600 }}>
|
<div className="amenity-option-meta" style={{ fontWeight: 600 }}>
|
||||||
<span className="amenity-name">{t('billingIncludeVat')}</span>
|
<span className="amenity-name">{t('billingIncludeVat')}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -251,7 +258,7 @@ export default function ProfilePage() {
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ border: '1px solid #eee', padding: 12, borderRadius: 6 }}>
|
<div style={{ border: '1px solid rgba(148,163,184,0.3)', padding: 12, borderRadius: 8, background: 'rgba(255,255,255,0.02)' }}>
|
||||||
<div style={{ marginBottom: 8 }}>
|
<div style={{ marginBottom: 8 }}>
|
||||||
<strong>{t('billingListingsTitle')}</strong>
|
<strong>{t('billingListingsTitle')}</strong>
|
||||||
<div style={{ color: '#555', fontSize: 13 }}>{t('billingListingsLead')}</div>
|
<div style={{ color: '#555', fontSize: 13 }}>{t('billingListingsLead')}</div>
|
||||||
|
|
@ -270,11 +277,11 @@ export default function ProfilePage() {
|
||||||
? 'yes'
|
? 'yes'
|
||||||
: 'no';
|
: 'no';
|
||||||
return (
|
return (
|
||||||
<div key={listing.id} style={{ border: '1px solid #f0f0f0', padding: 10, borderRadius: 4 }}>
|
<div key={listing.id} style={{ border: '1px solid #f0f0f0', padding: 10, borderRadius: 6, display: 'grid', gap: 8 }}>
|
||||||
<div style={{ fontWeight: 600, marginBottom: 6 }}>
|
<div style={{ fontWeight: 600 }}>
|
||||||
{listing.title} ({listing.slug})
|
{listing.title} ({listing.slug})
|
||||||
</div>
|
</div>
|
||||||
<div style={{ display: 'grid', gap: 8 }}>
|
<div style={{ display: 'grid', gap: 8, gridTemplateColumns: 'repeat(auto-fit, minmax(240px, 1fr))' }}>
|
||||||
<label>
|
<label>
|
||||||
{t('billingAccountNameLabel')}
|
{t('billingAccountNameLabel')}
|
||||||
<input
|
<input
|
||||||
|
|
@ -331,19 +338,17 @@ export default function ProfilePage() {
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<p style={{ color: '#666' }}>{t('billingDisabledHint')}</p>
|
<p style={{ color: '#666', margin: 0 }}>{t('billingDisabledHint')}</p>
|
||||||
)}
|
)}
|
||||||
<div>
|
<div>
|
||||||
<button className="button" type="submit" disabled={billingSaving}>
|
<button className="button" type="submit" disabled={billingSaving} style={{ minWidth: 160 }}>
|
||||||
{billingSaving ? t('saving') : t('save')}
|
{billingSaving ? t('saving') : t('save')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : null}
|
||||||
<p style={{ color: 'red' }}>{error ?? t('notLoggedIn')}</p>
|
|
||||||
)}
|
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue