'use client';

import { usePortalI18n } from '@/lib/i18n/provider';

const OPTIONS = [
  { value: 'zh-CN', label: 'ZH' },
  { value: 'en-US', label: 'EN' },
] as const;

export function LanguageSwitcher() {
  const { locale, setLocale } = usePortalI18n();

  return (
    <div className="language-switcher">
      <span>Lang</span>
      {OPTIONS.map((option) => (
        <button
          key={option.value}
          type="button"
          onClick={() => setLocale(option.value)}
          className={locale === option.value ? 'is-active' : undefined}
        >
          {option.label}
        </button>
      ))}
    </div>
  );
}
