Skip to content

Commit

Permalink
Replacing NODE_ENV by MODE
Browse files Browse the repository at this point in the history
Following the vite migration
  • Loading branch information
sim51 committed Jan 31, 2024
1 parent 34eddec commit e6d3641
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/components/LocalSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ const DEFAULT_FLAG = <HiMiniLanguage className="fs-5" />;
function getIcon(locale: string): ReactNode {
return locale === "dev" ? DEFAULT_FLAG : localeEmoji(locale) || DEFAULT_FLAG;
}

console.log(import.meta.env);
const AVAILABLE_LOCALES = toPairs(LOCALES)
.filter(([key]) => import.meta.env.NODE_ENV === "development" || key !== "dev")
.filter(([key]) => import.meta.env.MODE === "development" || key !== "dev")
.map(([key, locale]) => ({
value: key,
label: (
Expand All @@ -27,10 +27,9 @@ const AVAILABLE_LOCALES = toPairs(LOCALES)
const LocalSwitcher: FC = () => {
const { locale } = usePreferences();
const { changeLocale } = usePreferencesActions();

return (
<Tooltip closeOnClickContent attachment="top middle" targetAttachment="bottom middle">
<button className="btn p-0">{getIcon(locale)}</button>
<button className="btn p-0 fs-4">{getIcon(locale)}</button>
<div className="dropdown-menu show over-modal position-relative">
{AVAILABLE_LOCALES.map((option, i) => (
<button
Expand Down
2 changes: 1 addition & 1 deletion src/locales/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const i18n = i18next.use(initReactI18next).use(LngDetector);

i18n
.init({
debug: import.meta.env.NODE_ENV !== "production",
debug: import.meta.env.MODE !== "production",
fallbackLng: DEFAULT_LOCALE,
resources: LOCALES,
detection: {
Expand Down

0 comments on commit e6d3641

Please sign in to comment.