Initial BizOne portal setup

This commit is contained in:
2026-05-11 11:36:33 +07:00
commit 57017dd397
249 changed files with 41305 additions and 0 deletions

View File

@ -0,0 +1,66 @@
'use client';
import { usePathname } from 'next/navigation';
import { useState } from 'react';
import { setLocaleAction } from '../app/actions';
import type { Locale } from '../lib/i18n';
type Props = {
currentLocale: Locale;
label: string;
englishLabel: string;
indonesianLabel: string;
submitLabel: string;
variant?: 'default' | 'compact';
};
export function LanguageSwitcher({
currentLocale,
label,
englishLabel,
indonesianLabel,
submitLabel,
variant = 'default',
}: Props) {
const pathname = usePathname();
const [locale, setLocale] = useState<Locale>(currentLocale);
if (variant === 'compact') {
return (
<form action={setLocaleAction} className="language-switcher language-switcher-compact">
<input type="hidden" name="redirectPath" value={pathname} />
<span className="sr-only">{label}</span>
<button
type="submit"
name="locale"
value="en"
className={currentLocale === 'en' ? 'is-active' : ''}
>
EN
</button>
<button
type="submit"
name="locale"
value="id"
className={currentLocale === 'id' ? 'is-active' : ''}
>
ID
</button>
</form>
);
}
return (
<form action={setLocaleAction} className="language-switcher">
<input type="hidden" name="redirectPath" value={pathname} />
<label>
<span>{label}</span>
<select name="locale" value={locale} onChange={(event) => setLocale(event.target.value as Locale)}>
<option value="id">{indonesianLabel}</option>
<option value="en">{englishLabel}</option>
</select>
</label>
<button type="submit">{submitLabel}</button>
</form>
);
}