优化页面,国际化细节内容
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
||||
import type { SlashCommand } from "@/lib/api";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { useTrackEvent, useFeatureAdoptionTracking } from "@/hooks";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
interface SlashCommandPickerProps {
|
||||
/**
|
||||
@@ -79,6 +80,7 @@ export const SlashCommandPicker: React.FC<SlashCommandPickerProps> = ({
|
||||
initialQuery = "",
|
||||
className,
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const [commands, setCommands] = useState<SlashCommand[]>([]);
|
||||
const [filteredCommands, setFilteredCommands] = useState<SlashCommand[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
@@ -241,7 +243,7 @@ export const SlashCommandPicker: React.FC<SlashCommandPickerProps> = ({
|
||||
const groupedCommands = filteredCommands.reduce((acc, cmd) => {
|
||||
let key: string;
|
||||
if (cmd.scope === "user") {
|
||||
key = cmd.namespace ? `User Commands: ${cmd.namespace}` : "User Commands";
|
||||
key = cmd.namespace ? `${t('slashCommands.userCommands')}: ${cmd.namespace}` : t('slashCommands.userCommands');
|
||||
} else if (cmd.scope === "project") {
|
||||
key = cmd.namespace ? `Project Commands: ${cmd.namespace}` : "Project Commands";
|
||||
} else {
|
||||
@@ -278,10 +280,10 @@ export const SlashCommandPicker: React.FC<SlashCommandPickerProps> = ({
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<Command className="h-4 w-4 text-muted-foreground" />
|
||||
<span className="text-sm font-medium">Slash Commands</span>
|
||||
<span className="text-sm font-medium">{t('slashCommands.slashCommands')}</span>
|
||||
{searchQuery && (
|
||||
<span className="text-xs text-muted-foreground">
|
||||
Searching: "{searchQuery}"
|
||||
{t('slashCommands.searching')}: "{searchQuery}"
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
@@ -474,7 +476,7 @@ export const SlashCommandPicker: React.FC<SlashCommandPickerProps> = ({
|
||||
{Object.entries(groupedCommands).map(([groupKey, groupCommands]) => (
|
||||
<div key={groupKey}>
|
||||
<h3 className="text-xs font-medium text-muted-foreground uppercase tracking-wider px-3 mb-1 flex items-center gap-2">
|
||||
{groupKey.startsWith("User Commands") && <User className="h-3 w-3" />}
|
||||
{groupKey.startsWith(t('slashCommands.userCommands')) && <User className="h-3 w-3" />}
|
||||
{groupKey.startsWith("Project Commands") && <Building2 className="h-3 w-3" />}
|
||||
{groupKey}
|
||||
</h3>
|
||||
|
||||
Reference in New Issue
Block a user