refactor(blocks): consume runtime localized text
Replace the blocks-local LocalizedText implementation with the shared i18n runtime primitive in navigation and appearance blocks.\n\nRemove the former blocks component entry point as requested; consumers must now import LocalizedText from @workspace/i18n.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { useCallback, useState } from "react"
|
import { useCallback, useState } from "react"
|
||||||
import { useHotkey } from "@tanstack/react-hotkeys"
|
import { useHotkey } from "@tanstack/react-hotkeys"
|
||||||
import { useMessage } from "@workspace/i18n"
|
import { LocalizedText, useMessage } from "@workspace/i18n"
|
||||||
import { useResolvedTheme, useUiState } from "./ui-state"
|
import { useResolvedTheme, useUiState } from "./ui-state"
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
@@ -16,7 +16,6 @@ import {
|
|||||||
import { appearanceDialogHandle } from "./dialog"
|
import { appearanceDialogHandle } from "./dialog"
|
||||||
import { CompactPreference, ModePreference } from "./preferences"
|
import { CompactPreference, ModePreference } from "./preferences"
|
||||||
import { ThemeConfigPanel } from "./theme-config-panel"
|
import { ThemeConfigPanel } from "./theme-config-panel"
|
||||||
import { LocalizedText } from "../../components/localized-text"
|
|
||||||
import { appearanceMessages } from "./messages"
|
import { appearanceMessages } from "./messages"
|
||||||
|
|
||||||
interface AppearanceHotkeysProps {
|
interface AppearanceHotkeysProps {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { MonitorIcon, MoonIcon, SunIcon } from "lucide-react"
|
import { MonitorIcon, MoonIcon, SunIcon } from "lucide-react"
|
||||||
import { useMessage } from "@workspace/i18n"
|
import { LocalizedText, useMessage } from "@workspace/i18n"
|
||||||
import {
|
import {
|
||||||
Select,
|
Select,
|
||||||
SelectContent,
|
SelectContent,
|
||||||
@@ -11,7 +11,6 @@ import { Switch } from "@workspace/ui/components/switch"
|
|||||||
|
|
||||||
import type { ThemeMode } from "./state"
|
import type { ThemeMode } from "./state"
|
||||||
import { useUiState } from "./ui-state"
|
import { useUiState } from "./ui-state"
|
||||||
import { LocalizedText } from "../../components/localized-text"
|
|
||||||
import { appearanceMessages } from "./messages"
|
import { appearanceMessages } from "./messages"
|
||||||
|
|
||||||
function ModeIcon({ mode }: { mode: ThemeMode | null }) {
|
function ModeIcon({ mode }: { mode: ThemeMode | null }) {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { MoonIcon, SunIcon } from "lucide-react"
|
import { MoonIcon, SunIcon } from "lucide-react"
|
||||||
|
import { LocalizedText } from "@workspace/i18n"
|
||||||
import { useUiState } from "./ui-state"
|
import { useUiState } from "./ui-state"
|
||||||
import { Badge } from "@workspace/ui/components/badge"
|
import { Badge } from "@workspace/ui/components/badge"
|
||||||
import {
|
import {
|
||||||
@@ -8,7 +9,6 @@ import {
|
|||||||
} from "./theme-color-picker"
|
} from "./theme-color-picker"
|
||||||
import { ThemePreview } from "./theme-preview"
|
import { ThemePreview } from "./theme-preview"
|
||||||
import type { ThemeScheme } from "./theme"
|
import type { ThemeScheme } from "./theme"
|
||||||
import { LocalizedText } from "../../components/localized-text"
|
|
||||||
import { appearanceMessages } from "./messages"
|
import { appearanceMessages } from "./messages"
|
||||||
|
|
||||||
export function ThemeConfigPanel({
|
export function ThemeConfigPanel({
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { cn } from "@workspace/ui/lib/utils"
|
import { cn } from "@workspace/ui/lib/utils"
|
||||||
|
import { LocalizedText } from "@workspace/i18n"
|
||||||
|
|
||||||
import { LocalizedText } from "../../components/localized-text"
|
|
||||||
import type { NavigationLabelValue } from "./types"
|
import type { NavigationLabelValue } from "./types"
|
||||||
|
|
||||||
export interface NavigationLabelProps {
|
export interface NavigationLabelProps {
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
import { useMessage, type MessageDescriptor } from "@workspace/i18n"
|
|
||||||
|
|
||||||
export interface LocalizedTextProps {
|
|
||||||
message: MessageDescriptor
|
|
||||||
}
|
|
||||||
|
|
||||||
export function LocalizedText({ message }: LocalizedTextProps) {
|
|
||||||
return useMessage(message)
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user