mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Translate all the strings
This commit is contained in:
17 files changed
+569
-191
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import { useState, useMemo } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Check, ChevronDown, Edit3, RefreshCw, AlertCircle, Settings } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
@@ -23,8 +24,9 @@ export function ModelSelector({
|
||||
onChange,
|
||||
className,
|
||||
disabled = false,
|
||||
placeholder = "Select or enter a model...",
|
||||
placeholder,
|
||||
}: ModelSelectorProps) {
|
||||
const { t } = useTranslation();
|
||||
const [open, setOpen] = useState(false);
|
||||
const [isCustomInput, setIsCustomInput] = useState(false);
|
||||
const [customValue, setCustomValue] = useState('');
|
||||
@@ -32,6 +34,8 @@ export function ModelSelector({
|
||||
const { models, isLoading, error, refetch } = useProviderModels();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const defaultPlaceholder = t('selectOrEnterModel');
|
||||
|
||||
const recentlyUsedModels = useMemo(() => settings.recentlyUsedModels || [], [settings.recentlyUsedModels]);
|
||||
|
||||
// Group models by provider
|
||||
@@ -125,14 +129,14 @@ export function ModelSelector({
|
||||
disabled={disabled}
|
||||
>
|
||||
<span className="w-full truncate">
|
||||
{value || placeholder}
|
||||
{value || placeholder || defaultPlaceholder}
|
||||
</span>
|
||||
<ChevronDown className="size-3 shrink-0 opacity-50" />
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent className="w-96 p-0" align="end">
|
||||
<Command>
|
||||
{isConfigured && <CommandInput placeholder="Search models..." className="h-9" />}
|
||||
{isConfigured && <CommandInput placeholder={t('searchModels')} className="h-9" />}
|
||||
<CommandList className="max-h-[300px]">
|
||||
{/* Custom model option and manage providers */}
|
||||
<CommandGroup>
|
||||
@@ -143,7 +147,7 @@ export function ModelSelector({
|
||||
className="cursor-pointer"
|
||||
>
|
||||
<Edit3 className="mr-2 h-4 w-4" />
|
||||
Enter custom model...
|
||||
{t('enterCustomModel')}
|
||||
</CommandItem>
|
||||
)}
|
||||
<CommandItem
|
||||
@@ -152,7 +156,7 @@ export function ModelSelector({
|
||||
className="cursor-pointer"
|
||||
>
|
||||
<Settings className="mr-2 h-4 w-4" />
|
||||
Manage providers...
|
||||
{t('manageProviders')}
|
||||
</CommandItem>
|
||||
</CommandGroup>
|
||||
|
||||
@@ -160,13 +164,13 @@ export function ModelSelector({
|
||||
|
||||
<CommandEmpty>
|
||||
<div className="py-6 text-center text-sm text-muted-foreground">
|
||||
<p>No models found.</p>
|
||||
<p className="mt-2 text-xs">Try using a custom model instead.</p>
|
||||
<p>{t('noModelsFound')}</p>
|
||||
<p className="mt-2 text-xs">{t('tryCustomModel')}</p>
|
||||
</div>
|
||||
</CommandEmpty>
|
||||
|
||||
{recentlyUsedModels.length > 0 && (
|
||||
<CommandGroup heading="Recently Used">
|
||||
<CommandGroup heading={t('recentlyUsed')}>
|
||||
{recentlyUsedModels.map((model) => (
|
||||
<CommandItem
|
||||
key={model}
|
||||
@@ -190,7 +194,7 @@ export function ModelSelector({
|
||||
|
||||
{/* Loading state */}
|
||||
{isLoading && (
|
||||
<CommandGroup heading="Loading Models...">
|
||||
<CommandGroup heading={t('loading')}>
|
||||
<div className="px-2 py-1.5">
|
||||
<div className="space-y-2">
|
||||
<Skeleton className="h-4 w-full" />
|
||||
@@ -203,7 +207,7 @@ export function ModelSelector({
|
||||
|
||||
{/* Error state */}
|
||||
{error && !isLoading && (
|
||||
<CommandGroup heading="Error Loading Models">
|
||||
<CommandGroup heading={t('errorLoadingModels')}>
|
||||
<div className="px-2 py-1.5 text-sm text-muted-foreground">
|
||||
<div className="flex items-start gap-2">
|
||||
<AlertCircle className="h-4 w-4 text-destructive flex-shrink-0 mt-0.5" />
|
||||
@@ -216,7 +220,7 @@ export function ModelSelector({
|
||||
className="h-7 text-xs"
|
||||
>
|
||||
<RefreshCw className="h-3 w-3 mr-1" />
|
||||
Retry
|
||||
{t('retry')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Plus, Folder, GitBranch, Loader2, ChevronDown, Star, Columns2, X, Settings, HelpCircle } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
@@ -87,6 +88,7 @@ export function ProjectSidebar({
|
||||
onToggleSidebar,
|
||||
onClose
|
||||
}: ProjectSidebarProps) {
|
||||
const { t } = useTranslation();
|
||||
const queryClient = useQueryClient();
|
||||
const { data: projects = [], isLoading, error } = useProjects();
|
||||
const [favorites] = useLocalStorage<string[]>('project-favorites', []);
|
||||
@@ -144,7 +146,7 @@ export function ProjectSidebar({
|
||||
size="sm"
|
||||
className="h-8 w-8 p-0 hover:bg-primary/10 -mr-2"
|
||||
onClick={handleToggleSidebar}
|
||||
aria-label={(onClose && isMobile) ? "Close sidebar" : "Collapse sidebar"}
|
||||
aria-label={(onClose && isMobile) ? t('closeSidebar') : t('collapseSidebar')}
|
||||
>
|
||||
{(onClose && isMobile) ? (
|
||||
<X className="h-4 w-4 text-primary/60 hover:text-primary" />
|
||||
@@ -167,7 +169,7 @@ export function ProjectSidebar({
|
||||
className="flex-1 flex items-center justify-center px-3 py-2 text-sm font-medium text-primary-foreground rounded-l-md hover:bg-white/10 transition-colors"
|
||||
>
|
||||
<Plus className="h-4 w-4 mr-2" />
|
||||
New Project
|
||||
{t('newProject')}
|
||||
</button>
|
||||
<div className="w-px bg-white/20" />
|
||||
<DropdownMenu>
|
||||
@@ -182,7 +184,7 @@ export function ProjectSidebar({
|
||||
className="flex items-center gap-2 w-full"
|
||||
>
|
||||
<GitBranch className="h-4 w-4" />
|
||||
Import Repository
|
||||
{t('importRepository')}
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
@@ -204,8 +206,8 @@ export function ProjectSidebar({
|
||||
) : projects.length === 0 ? (
|
||||
<div className="text-center p-6 text-muted-foreground">
|
||||
<Folder className="h-8 w-8 mx-auto mb-2 opacity-50" />
|
||||
<p className="text-sm">No projects yet</p>
|
||||
<p className="text-xs">Create your first project to get started</p>
|
||||
<p className="text-sm">{t('noProjectsYet')}</p>
|
||||
<p className="text-xs">{t('createFirstProject')}</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-1">
|
||||
@@ -233,14 +235,14 @@ export function ProjectSidebar({
|
||||
onClick={() => navigateAndClose('/settings')}
|
||||
>
|
||||
<Settings className="h-4 w-4 transition-colors duration-200" />
|
||||
Settings
|
||||
{t('settings')}
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="h-9 w-9 p-0 text-sidebar-foreground dark:hover:text-sidebar-primary hover:bg-primary/10 dark:hover:bg-sidebar-accent/30 transition-all duration-200"
|
||||
onClick={() => window.open('https://soapbox.pub/shakespeare-resources/', '_blank')}
|
||||
aria-label="Help"
|
||||
aria-label={t('help')}
|
||||
>
|
||||
<HelpCircle className="h-4 w-4 transition-colors duration-200" />
|
||||
</Button>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useNavigate, useLocation, Outlet } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { ScrollArea } from '@/components/ui/scroll-area';
|
||||
import { Menu, Bot, GitBranch, Database, Wifi, Settings2 } from 'lucide-react';
|
||||
@@ -18,45 +19,47 @@ interface SettingsItem {
|
||||
href: string;
|
||||
}
|
||||
|
||||
const settingsItems: SettingsItem[] = [
|
||||
// Define settings items as a function to get fresh translations
|
||||
const getSettingsItems = (t: (key: string) => string): SettingsItem[] => [
|
||||
{
|
||||
id: 'preferences',
|
||||
title: 'Preferences',
|
||||
description: 'General application preferences and appearance',
|
||||
title: t('preferences'),
|
||||
description: t('preferencesDescription'),
|
||||
icon: Settings2,
|
||||
href: '/settings/preferences',
|
||||
},
|
||||
{
|
||||
id: 'ai',
|
||||
title: 'AI Settings',
|
||||
description: 'Configure AI providers and API keys',
|
||||
title: t('aiSettings'),
|
||||
description: t('aiSettingsDescription'),
|
||||
icon: Bot,
|
||||
href: '/settings/ai',
|
||||
},
|
||||
{
|
||||
id: 'git',
|
||||
title: 'Git Settings',
|
||||
description: 'Configure Git credentials for HTTP authentication',
|
||||
title: t('gitSettings'),
|
||||
description: t('gitSettingsDescription'),
|
||||
icon: GitBranch,
|
||||
href: '/settings/git',
|
||||
},
|
||||
{
|
||||
id: 'nostr',
|
||||
title: 'Nostr Settings',
|
||||
description: 'Configure relay connections and Nostr preferences',
|
||||
title: t('nostrSettings'),
|
||||
description: t('nostrSettingsDescription'),
|
||||
icon: Wifi,
|
||||
href: '/settings/nostr',
|
||||
},
|
||||
{
|
||||
id: 'data',
|
||||
title: 'Data',
|
||||
description: 'Export files and manage local data',
|
||||
title: t('dataSettings'),
|
||||
description: t('dataSettingsDescription'),
|
||||
icon: Database,
|
||||
href: '/settings/data',
|
||||
},
|
||||
];
|
||||
|
||||
export function SettingsLayout() {
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const isMobile = useIsMobile();
|
||||
@@ -104,6 +107,7 @@ export function SettingsLayout() {
|
||||
};
|
||||
|
||||
// Get current settings page
|
||||
const settingsItems = getSettingsItems(t);
|
||||
const currentPath = location.pathname;
|
||||
const currentSettingsId = settingsItems.find(item => item.href === currentPath)?.id;
|
||||
|
||||
@@ -117,11 +121,11 @@ export function SettingsLayout() {
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => setIsSidebarVisible(!isSidebarVisible)}
|
||||
aria-label="Toggle sidebar"
|
||||
aria-label={t('toggleSidebar')}
|
||||
>
|
||||
<Menu className="h-4 w-4" />
|
||||
</Button>
|
||||
<h1 className="text-lg font-semibold">Settings</h1>
|
||||
<h1 className="text-lg font-semibold">{t('settings')}</h1>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -176,13 +180,13 @@ export function SettingsLayout() {
|
||||
size="sm"
|
||||
onClick={() => setIsSidebarVisible(true)}
|
||||
className="h-8 w-8 p-0"
|
||||
aria-label="Open sidebar"
|
||||
aria-label={t('openSidebar')}
|
||||
>
|
||||
<Menu className="h-4 w-4" />
|
||||
</Button>
|
||||
)}
|
||||
<h1 className="text-xl font-bold flex items-center gap-2">
|
||||
Settings
|
||||
{t('settings')}
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useState, useRef, useEffect, forwardRef, useImperativeHandle, useMemo, useCallback } from 'react';
|
||||
import { useSearchParams } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
@@ -67,6 +68,7 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
||||
isBuildLoading: externalIsBuildLoading,
|
||||
isDeployLoading: externalIsDeployLoading
|
||||
}, ref) => {
|
||||
const { t } = useTranslation();
|
||||
const [input, setInput] = useState('');
|
||||
const [systemPrompt, setSystemPrompt] = useState('');
|
||||
const [showScrollToBottom, setShowScrollToBottom] = useState(false);
|
||||
@@ -417,12 +419,12 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
||||
<div className="text-center space-y-4 max-w-md mx-auto p-6">
|
||||
<div className="text-4xl mb-4">🤖</div>
|
||||
<div>
|
||||
<h3 className="text-lg font-semibold mb-2 bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">AI Assistant Not Configured</h3>
|
||||
<h3 className="text-lg font-semibold mb-2 bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">{t('aiNotConfigured')}</h3>
|
||||
<p className="text-sm text-muted-foreground mb-4">
|
||||
Please configure your AI settings to start building with AI assistance.
|
||||
{t('configureAI')}
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Use the menu in the top bar to access AI Settings.
|
||||
{t('useMenuForAI')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -445,16 +447,16 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
||||
<div className="text-6xl mb-6">🎭</div>
|
||||
<div>
|
||||
<h3 className="text-xl font-semibold mb-2 bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">
|
||||
Welcome to Shakespeare
|
||||
{t('welcomeToShakespeare')}
|
||||
</h3>
|
||||
<p className="text-muted-foreground mb-6 leading-relaxed">
|
||||
Your AI-powered development assistant is ready to help you build, edit, and enhance your project.
|
||||
{t('aiAssistantReady')}
|
||||
</p>
|
||||
<div className="space-y-2 text-sm text-muted-foreground">
|
||||
<p>💡 Ask me to add new features</p>
|
||||
<p>📝 Request file edits and improvements</p>
|
||||
<p>🔧 Get help with debugging and optimization</p>
|
||||
<p>🚀 Build and deploy your project</p>
|
||||
<p>{t('askMeFeatures')}</p>
|
||||
<p>{t('requestEdits')}</p>
|
||||
<p>{t('getHelp')}</p>
|
||||
<p>{t('buildDeploy')}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -512,7 +514,7 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
||||
<div className="flex items-center gap-2 px-2 py-1 text-xs text-muted-foreground">
|
||||
<Loader2 className="h-3 w-3 animate-spin flex-shrink-0" />
|
||||
<span className="font-medium">
|
||||
Running {streamingMessage.tool_calls?.[0]?.function?.name || 'tool'}...
|
||||
{t('running')} {streamingMessage.tool_calls?.[0]?.function?.name || 'tool'}...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -543,7 +545,7 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
||||
onKeyDown={handleKeyDown}
|
||||
onPaste={handlePaste}
|
||||
onFocus={handleFirstInteraction}
|
||||
placeholder={providerModel.trim() ? "Ask me to add features, edit files, or build your project..." : "Please select a model to start chatting..."}
|
||||
placeholder={providerModel.trim() ? t('askToAddFeatures') : t('selectModelFirst')}
|
||||
className="flex-1 resize-none border-0 bg-transparent px-4 py-3 text-sm focus-visible:ring-0 focus-visible:ring-offset-0 placeholder:text-muted-foreground"
|
||||
disabled={isLoading || !providerModel.trim()}
|
||||
rows={1}
|
||||
@@ -583,7 +585,11 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
||||
</div>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>
|
||||
<p>Context usage: {lastInputTokens.toLocaleString()} / {currentModel.contextLength.toLocaleString()} tokens ({contextUsagePercentage.toFixed(1)}%)</p>
|
||||
<p>{t('contextUsage', {
|
||||
tokens: lastInputTokens.toLocaleString(),
|
||||
total: currentModel.contextLength.toLocaleString(),
|
||||
percentage: contextUsagePercentage.toFixed(1)
|
||||
})}</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
@@ -599,7 +605,7 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
||||
</div>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>
|
||||
<p>Total cost for this chat session</p>
|
||||
<p>{t('totalCostSession')}</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
@@ -612,7 +618,7 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
||||
onChange={setProviderModel}
|
||||
className="w-full"
|
||||
disabled={isLoading}
|
||||
placeholder="Choose a model..."
|
||||
placeholder={t('chooseModel')}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
@@ -15,6 +16,7 @@ interface FileEditorProps {
|
||||
}
|
||||
|
||||
export function FileEditor({ filePath, content, onSave, isLoading, projectId }: FileEditorProps) {
|
||||
const { t } = useTranslation();
|
||||
const [editedContent, setEditedContent] = useState(content);
|
||||
const [isSaving, setIsSaving] = useState(false);
|
||||
const [hasChanges, setHasChanges] = useState(false);
|
||||
@@ -99,7 +101,7 @@ export function FileEditor({ filePath, content, onSave, isLoading, projectId }:
|
||||
<CardTitle className={cn("text-sm sm:text-base truncate flex-1 mr-2", gitStatusClasses)}>{filePath}</CardTitle>
|
||||
<div className="flex items-center space-x-1 sm:space-x-2">
|
||||
{hasChanges && (
|
||||
<span className="text-xs sm:text-sm text-muted-foreground hidden sm:inline">Unsaved changes</span>
|
||||
<span className="text-xs sm:text-sm text-muted-foreground hidden sm:inline">{t('unsavedChanges')}</span>
|
||||
)}
|
||||
<Button
|
||||
onClick={handleSave}
|
||||
@@ -110,19 +112,19 @@ export function FileEditor({ filePath, content, onSave, isLoading, projectId }:
|
||||
{isSaving ? (
|
||||
<>
|
||||
<Loader2 className="mr-1 sm:mr-2 h-4 w-4 animate-spin" />
|
||||
<span className="hidden sm:inline">Saving...</span>
|
||||
<span className="hidden sm:inline">{t('saving')}</span>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Save className="sm:mr-2 h-4 w-4" />
|
||||
<span className="hidden sm:inline">Save</span>
|
||||
<span className="hidden sm:inline">{t('save')}</span>
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="text-xs text-muted-foreground mt-1">
|
||||
Language: {getLanguageFromPath(filePath)}
|
||||
{t('languageLabel')}: {getLanguageFromPath(filePath)}
|
||||
</div>
|
||||
</CardHeader>
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useState, useEffect, useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useProjectsManager } from '@/hooks/useProjectsManager';
|
||||
import { useFS } from '@/hooks/useFS';
|
||||
import { useGitStatus } from '@/hooks/useGitStatus';
|
||||
@@ -22,6 +23,7 @@ interface FileNode {
|
||||
}
|
||||
|
||||
export function FileTree({ projectId, onFileSelect, selectedFile }: FileTreeProps) {
|
||||
const { t } = useTranslation();
|
||||
const [tree, setTree] = useState<FileNode[]>([]);
|
||||
const [filteredTree, setFilteredTree] = useState<FileNode[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
@@ -179,7 +181,7 @@ export function FileTree({ projectId, onFileSelect, selectedFile }: FileTreeProp
|
||||
for (const node of nodes) {
|
||||
if (node.type === 'file') {
|
||||
const fileNameMatch = node.name.toLowerCase().includes(searchTermLower);
|
||||
|
||||
|
||||
if (fileNameMatch) {
|
||||
results.push(node);
|
||||
}
|
||||
@@ -296,7 +298,7 @@ export function FileTree({ projectId, onFileSelect, selectedFile }: FileTreeProp
|
||||
<div className="relative">
|
||||
<Search className="absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" />
|
||||
<Input
|
||||
placeholder="Search files..."
|
||||
placeholder={t('searchFiles')}
|
||||
value={searchTerm}
|
||||
onChange={(e) => setSearchTerm(e.target.value)}
|
||||
className="pl-8"
|
||||
@@ -313,7 +315,7 @@ export function FileTree({ projectId, onFileSelect, selectedFile }: FileTreeProp
|
||||
</div>
|
||||
) : filteredTree.length === 0 ? (
|
||||
<div className="text-center text-sm text-muted-foreground py-4">
|
||||
{searchTerm ? 'No files found matching your search' : 'No files found'}
|
||||
{searchTerm ? t('noFilesFoundSearch') : t('noFilesFound')}
|
||||
</div>
|
||||
) : (
|
||||
filteredTree.map(node => renderNode(node))
|
||||
|
||||
@@ -71,24 +71,6 @@ describe('LoginArea', () => {
|
||||
expect(screen.getByTestId('account-switcher')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows anonymous user menu when user is not logged in', () => {
|
||||
mockUseLoggedInAccounts.mockReturnValue({
|
||||
authors: [],
|
||||
currentUser: undefined,
|
||||
otherUsers: [],
|
||||
setLogin: vi.fn(),
|
||||
removeLogin: vi.fn(),
|
||||
isLoading: false
|
||||
});
|
||||
|
||||
render(<LoginArea />);
|
||||
|
||||
// Should show anonymous user display
|
||||
expect(screen.getByText('Anonymous')).toBeInTheDocument();
|
||||
|
||||
// Should show the dropdown trigger button
|
||||
expect(screen.getByRole('button')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// It is important that all functionality in this file is preserved, and should only be modified if explicitly requested.
|
||||
|
||||
import { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { User, UserPlus, ChevronDown, Settings, HelpCircle } from 'lucide-react';
|
||||
import {
|
||||
DropdownMenu,
|
||||
@@ -23,6 +24,7 @@ export interface LoginAreaProps {
|
||||
}
|
||||
|
||||
export function LoginArea({ className }: LoginAreaProps) {
|
||||
const { t } = useTranslation();
|
||||
const { currentUser } = useLoggedInAccounts();
|
||||
const navigate = useNavigate();
|
||||
const [loginDialogOpen, setLoginDialogOpen] = useState(false);
|
||||
@@ -47,7 +49,7 @@ export function LoginArea({ className }: LoginAreaProps) {
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
<div className='flex-1 text-left truncate'>
|
||||
<p className='font-medium text-sm truncate'>Anonymous</p>
|
||||
<p className='font-medium text-sm truncate'>{t('anonymous')}</p>
|
||||
</div>
|
||||
<ChevronDown className='w-4 h-4 text-muted-foreground' />
|
||||
</button>
|
||||
@@ -58,14 +60,14 @@ export function LoginArea({ className }: LoginAreaProps) {
|
||||
className='flex items-center gap-2 cursor-pointer p-2 rounded-md'
|
||||
>
|
||||
<Settings className='w-4 h-4' />
|
||||
<span>Settings</span>
|
||||
<span>{t('settings')}</span>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
onClick={() => window.open('https://soapbox.pub/shakespeare-resources/', '_blank')}
|
||||
className='flex items-center gap-2 cursor-pointer p-2 rounded-md'
|
||||
>
|
||||
<HelpCircle className='w-4 h-4' />
|
||||
<span>Help</span>
|
||||
<span>{t('help')}</span>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem
|
||||
@@ -73,14 +75,14 @@ export function LoginArea({ className }: LoginAreaProps) {
|
||||
className='flex items-center gap-2 cursor-pointer p-2 rounded-md'
|
||||
>
|
||||
<User className='w-4 h-4' />
|
||||
<span>Log in</span>
|
||||
<span>{t('logIn')}</span>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
onClick={() => setSignupDialogOpen(true)}
|
||||
className='flex items-center gap-2 cursor-pointer p-2 rounded-md'
|
||||
>
|
||||
<UserPlus className='w-4 h-4' />
|
||||
<span>Sign up</span>
|
||||
<span>{t('signUp')}</span>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
|
||||
+368
-6
@@ -9,9 +9,14 @@ const resources = {
|
||||
preferences: 'Preferences',
|
||||
settings: 'Settings',
|
||||
backToSettings: 'Back to Settings',
|
||||
help: 'Help',
|
||||
anonymous: 'Anonymous',
|
||||
|
||||
// Authentication
|
||||
logIn: 'Log in',
|
||||
signUp: 'Sign up',
|
||||
|
||||
// Preferences Page
|
||||
preferencesTitle: 'Preferences',
|
||||
preferencesDescription: 'Manage your general application preferences and appearance settings.',
|
||||
|
||||
// Appearance Section
|
||||
@@ -47,6 +52,9 @@ const resources = {
|
||||
success: 'Success',
|
||||
warning: 'Warning',
|
||||
info: 'Information',
|
||||
add: 'Add',
|
||||
remove: 'Remove',
|
||||
retry: 'Retry',
|
||||
|
||||
// Shakespeare Main Page
|
||||
buildNostrApps: 'Build Nostr apps with AI',
|
||||
@@ -55,11 +63,10 @@ const resources = {
|
||||
generating: 'Generating...',
|
||||
creating: 'Creating...',
|
||||
chooseModel: 'Choose a model...',
|
||||
selectModelFirst: "Please select a model below, then describe what you'd like to build...",
|
||||
selectModelToDescribe: "Please select a model below, then describe what you'd like to build...",
|
||||
examplePrompt: "e.g., Create a farming equipment marketplace for local farmers to buy and sell tractors, tools, and supplies...",
|
||||
|
||||
// Settings Page
|
||||
settingsTitle: 'Settings',
|
||||
settingsDescription: 'Manage your application settings and preferences.',
|
||||
aiSettings: 'AI Settings',
|
||||
aiSettingsDescription: 'Configure AI providers and API keys',
|
||||
@@ -69,6 +76,180 @@ const resources = {
|
||||
nostrSettingsDescription: 'Configure relay connections and Nostr preferences',
|
||||
dataSettings: 'Data',
|
||||
dataSettingsDescription: 'Export files and manage local data',
|
||||
|
||||
// Project Sidebar
|
||||
newProject: 'New Project',
|
||||
importRepository: 'Import Repository',
|
||||
noProjectsYet: 'No projects yet',
|
||||
createFirstProject: 'Create your first project to get started',
|
||||
closeSidebar: 'Close sidebar',
|
||||
collapseSidebar: 'Collapse sidebar',
|
||||
|
||||
// Chat Interface
|
||||
welcomeToShakespeare: 'Welcome to Shakespeare',
|
||||
aiAssistantReady: 'Your AI-powered development assistant is ready to help you build, edit, and enhance your project.',
|
||||
askMeFeatures: '💡 Ask me to add new features',
|
||||
requestEdits: '📝 Request file edits and improvements',
|
||||
getHelp: '🔧 Get help with debugging and optimization',
|
||||
buildDeploy: '🚀 Build and deploy your project',
|
||||
aiNotConfigured: 'AI Assistant Not Configured',
|
||||
configureAI: 'Please configure your AI settings to start building with AI assistance.',
|
||||
useMenuForAI: 'Use the menu in the top bar to access AI Settings.',
|
||||
askToAddFeatures: 'Ask me to add features, edit files, or build your project...',
|
||||
selectModelFirst: 'Please select a model to start chatting...',
|
||||
sendMessage: 'Send message',
|
||||
stopGeneration: 'Stop generation',
|
||||
running: 'Running',
|
||||
|
||||
// File Editor
|
||||
unsavedChanges: 'Unsaved changes',
|
||||
saving: 'Saving...',
|
||||
languageLabel: 'Language',
|
||||
|
||||
// File Tree
|
||||
searchFiles: 'Search files...',
|
||||
noFilesFound: 'No files found',
|
||||
noFilesFoundSearch: 'No files found matching your search',
|
||||
|
||||
// Git Dialog
|
||||
gitRepositoryStatus: 'Git Repository Status',
|
||||
repositoryStatusDescription: 'View repository status and sync with remote repositories',
|
||||
repositoryInformation: 'Repository Information',
|
||||
currentBranch: 'Current Branch',
|
||||
totalCommits: 'Total Commits',
|
||||
latestCommit: 'Latest Commit',
|
||||
remotes: 'Remotes',
|
||||
notGitRepository: 'Not a Git repository',
|
||||
gitAuthentication: 'Authentication',
|
||||
credentialsDescription: 'Credentials for push/pull operations',
|
||||
configured: 'Configured',
|
||||
noCredentials: 'No credentials',
|
||||
noCredentialsWarning: 'No credentials configured for {{provider}}. Push/pull operations may fail for private repositories.',
|
||||
configureCredentials: 'Configure credentials',
|
||||
syncStatus: 'Sync Status',
|
||||
pull: 'Pull',
|
||||
push: 'Push',
|
||||
pulling: 'Pulling...',
|
||||
pushing: 'Pushing...',
|
||||
upToDate: 'Up to date',
|
||||
commitsAhead: '{{count}} commit ahead | {{count}} commits ahead',
|
||||
commitsBehind: '{{count}} commit behind | {{count}} commits behind',
|
||||
uncommittedChanges: '{{count}} uncommitted change | {{count}} uncommitted changes',
|
||||
noRemoteConfigured: 'No remote configured',
|
||||
workingDirectoryChanges: 'Working Directory Changes',
|
||||
filesWithChanges: '{{count}} file with changes | {{count}} files with changes',
|
||||
workingDirectoryClean: 'Working directory is clean',
|
||||
noUncommittedChanges: 'No uncommitted changes',
|
||||
cannotPush: 'Cannot push',
|
||||
cannotPull: 'Cannot pull',
|
||||
notGitRepoOrBranch: 'Not a git repository or no current branch',
|
||||
noRemoteRepositories: 'No remote repositories configured',
|
||||
nothingToPush: 'Nothing to push',
|
||||
noCommitsAhead: 'No commits ahead of remote. Commit your changes first.',
|
||||
pushSuccessful: 'Push successful',
|
||||
pushFailed: 'Push failed',
|
||||
pullSuccessful: 'Pull successful',
|
||||
pullFailed: 'Pull failed',
|
||||
|
||||
// AI Settings
|
||||
aiSettingsDescriptionLong: 'Configure AI providers by adding your API keys. Settings are automatically saved and stored locally in your browser.',
|
||||
configuredProviders: 'Configured Providers',
|
||||
addProvider: 'Add Provider',
|
||||
getApiKey: 'Get API key',
|
||||
getToken: 'Get token',
|
||||
enterApiKey: 'Enter your API key',
|
||||
enterToken: 'Enter your token',
|
||||
enterCashuToken: 'Enter a Cashu token',
|
||||
addCustomProvider: 'Add Custom Provider',
|
||||
providerName: 'Provider Name',
|
||||
baseUrl: 'Base URL',
|
||||
apiKey: 'API Key',
|
||||
authentication: 'Authentication',
|
||||
addCustomProviderButton: 'Add Custom Provider',
|
||||
providerExists: 'Provider with this name already exists',
|
||||
custom: 'Custom',
|
||||
connecting: 'Connecting...',
|
||||
connectToGitHub: 'Connect to GitHub',
|
||||
|
||||
// Git Settings
|
||||
gitSettingsDescriptionLong: 'Configure Git credentials for HTTP authentication. Settings are automatically saved and stored locally in your browser.',
|
||||
configuredCredentials: 'Configured Credentials',
|
||||
origin: 'Origin',
|
||||
username: 'Username',
|
||||
password: 'Password',
|
||||
enterPassword: 'Enter your password/token',
|
||||
credentialsExist: 'Credentials for this origin already exist',
|
||||
corsProxy: 'CORS Proxy',
|
||||
corsProxyDescription: 'CORS proxy server used for all Git operations with remote repositories. Required for browser-based Git operations.',
|
||||
|
||||
// Data Settings
|
||||
dataSettingsDescriptionLong: 'Export files and manage local data.',
|
||||
exportFiles: 'Export Files',
|
||||
exportFilesDescription: 'Download all your projects and files as a ZIP archive. This includes all project files, settings, and data stored locally.',
|
||||
exportAllFiles: 'Export All Files',
|
||||
exporting: 'Exporting...',
|
||||
clearAllData: 'Clear All Data',
|
||||
clearAllDataDescription: 'Permanently delete all local data including projects, settings, and cached information. This action cannot be undone.',
|
||||
clearing: 'Clearing...',
|
||||
areYouSure: 'Are you absolutely sure?',
|
||||
clearDataWarning: 'This action will permanently delete all local data from this browser, including:',
|
||||
allProjects: 'All projects and their files',
|
||||
aiSettingsAndKeys: 'AI settings and API keys',
|
||||
gitCredentialsSettings: 'Git credentials and settings',
|
||||
userPreferences: 'User preferences and themes',
|
||||
cachedData: 'Cached data and session information',
|
||||
actionCannotBeUndone: 'This action cannot be undone. Consider exporting your files first.',
|
||||
yesClearAllData: 'Yes, clear all data',
|
||||
used: 'Used',
|
||||
available: 'Available',
|
||||
usagePercentage: '{{percentage}}% used',
|
||||
usageUnavailable: 'Usage percentage unavailable',
|
||||
loadingStorageInfo: 'Loading storage information...',
|
||||
filesExportedSuccessfully: 'Files exported successfully',
|
||||
filesExportedDescription: 'Your project files have been downloaded as a zip file.',
|
||||
failedToExportFiles: 'Failed to export files',
|
||||
dataClearedSuccessfully: 'Data cleared successfully',
|
||||
dataClearedDescription: 'All local data has been removed. Redirecting to homepage...',
|
||||
failedToClearData: 'Failed to clear data',
|
||||
|
||||
// 404 Page
|
||||
pageNotFound: 'Oops! Page not found',
|
||||
returnToHome: 'Return to Home',
|
||||
|
||||
// Model Selector
|
||||
selectOrEnterModel: 'Select or enter a model...',
|
||||
searchModels: 'Search models...',
|
||||
enterCustomModel: 'Enter custom model...',
|
||||
manageProviders: 'Manage providers...',
|
||||
noModelsFound: 'No models found.',
|
||||
tryCustomModel: 'Try using a custom model instead.',
|
||||
recentlyUsed: 'Recently Used',
|
||||
errorLoadingModels: 'Error Loading Models',
|
||||
|
||||
// Context and Cost
|
||||
contextUsage: 'Context usage: {{tokens}} / {{total}} tokens ({{percentage}}%)',
|
||||
totalCostSession: 'Total cost for this chat session',
|
||||
|
||||
// File Status
|
||||
added: 'added',
|
||||
deleted: 'deleted',
|
||||
modified: 'modified',
|
||||
staged: 'staged',
|
||||
untracked: 'untracked',
|
||||
|
||||
// Settings Layout
|
||||
toggleSidebar: 'Toggle sidebar',
|
||||
openSidebar: 'Open sidebar',
|
||||
|
||||
// Nostr Settings
|
||||
nostrSettingsDescriptionLong: 'Configure your Nostr connection settings and relay preferences.',
|
||||
nostrAccounts: 'Nostr Accounts',
|
||||
noAccountsLoggedIn: 'No accounts logged in. Add an account to get started.',
|
||||
createAccount: 'Create Account',
|
||||
addExistingAccount: 'Add Existing Account',
|
||||
addAccount: 'Add Account',
|
||||
relayConfiguration: 'Relay Configuration',
|
||||
selectedRelay: 'Selected Relay',
|
||||
}
|
||||
},
|
||||
pt: {
|
||||
@@ -77,9 +258,14 @@ const resources = {
|
||||
preferences: 'Preferências',
|
||||
settings: 'Configurações',
|
||||
backToSettings: 'Voltar às Configurações',
|
||||
help: 'Ajuda',
|
||||
anonymous: 'Anônimo',
|
||||
|
||||
// Authentication
|
||||
logIn: 'Entrar',
|
||||
signUp: 'Cadastrar',
|
||||
|
||||
// Preferences Page
|
||||
preferencesTitle: 'Preferências',
|
||||
preferencesDescription: 'Gerencie suas preferências gerais da aplicação e configurações de aparência.',
|
||||
|
||||
// Appearance Section
|
||||
@@ -115,6 +301,9 @@ const resources = {
|
||||
success: 'Sucesso',
|
||||
warning: 'Aviso',
|
||||
info: 'Informação',
|
||||
add: 'Adicionar',
|
||||
remove: 'Remover',
|
||||
retry: 'Tentar novamente',
|
||||
|
||||
// Shakespeare Main Page
|
||||
buildNostrApps: 'Construa aplicativos Nostr com IA',
|
||||
@@ -123,11 +312,10 @@ const resources = {
|
||||
generating: 'Gerando...',
|
||||
creating: 'Criando...',
|
||||
chooseModel: 'Escolha um modelo...',
|
||||
selectModelFirst: "Por favor, selecione um modelo abaixo e depois descreva o que gostaria de construir...",
|
||||
selectModelToDescribe: "Por favor, selecione um modelo abaixo e depois descreva o que gostaria de construir...",
|
||||
examplePrompt: "ex., Criar um marketplace de equipamentos agrícolas para fazendeiros locais comprarem e venderem tratores, ferramentas e suprimentos...",
|
||||
|
||||
// Settings Page
|
||||
settingsTitle: 'Configurações',
|
||||
settingsDescription: 'Gerencie as configurações e preferências da aplicação.',
|
||||
aiSettings: 'Configurações de IA',
|
||||
aiSettingsDescription: 'Configure provedores de IA e chaves de API',
|
||||
@@ -137,6 +325,180 @@ const resources = {
|
||||
nostrSettingsDescription: 'Configure conexões de relay e preferências do Nostr',
|
||||
dataSettings: 'Dados',
|
||||
dataSettingsDescription: 'Exporte arquivos e gerencie dados locais',
|
||||
|
||||
// Project Sidebar
|
||||
newProject: 'Novo Projeto',
|
||||
importRepository: 'Importar Repositório',
|
||||
noProjectsYet: 'Nenhum projeto ainda',
|
||||
createFirstProject: 'Crie seu primeiro projeto para começar',
|
||||
closeSidebar: 'Fechar barra lateral',
|
||||
collapseSidebar: 'Recolher barra lateral',
|
||||
|
||||
// Chat Interface
|
||||
welcomeToShakespeare: 'Bem-vindo ao Shakespeare',
|
||||
aiAssistantReady: 'Seu assistente de desenvolvimento com IA está pronto para ajudá-lo a construir, editar e aprimorar seu projeto.',
|
||||
askMeFeatures: '💡 Peça para adicionar novos recursos',
|
||||
requestEdits: '📝 Solicite edições e melhorias de arquivos',
|
||||
getHelp: '🔧 Obtenha ajuda com depuração e otimização',
|
||||
buildDeploy: '🚀 Construa e implante seu projeto',
|
||||
aiNotConfigured: 'Assistente de IA Não Configurado',
|
||||
configureAI: 'Configure suas configurações de IA para começar a construir com assistência de IA.',
|
||||
useMenuForAI: 'Use o menu na barra superior para acessar as Configurações de IA.',
|
||||
askToAddFeatures: 'Peça para adicionar recursos, editar arquivos ou construir seu projeto...',
|
||||
selectModelFirst: 'Selecione um modelo para começar a conversar...',
|
||||
sendMessage: 'Enviar mensagem',
|
||||
stopGeneration: 'Parar geração',
|
||||
running: 'Executando',
|
||||
|
||||
// File Editor
|
||||
unsavedChanges: 'Alterações não salvas',
|
||||
saving: 'Salvando...',
|
||||
languageLabel: 'Linguagem',
|
||||
|
||||
// File Tree
|
||||
searchFiles: 'Buscar arquivos...',
|
||||
noFilesFound: 'Nenhum arquivo encontrado',
|
||||
noFilesFoundSearch: 'Nenhum arquivo encontrado correspondente à sua busca',
|
||||
|
||||
// Git Dialog
|
||||
gitRepositoryStatus: 'Status do Repositório Git',
|
||||
repositoryStatusDescription: 'Visualizar status do repositório e sincronizar com repositórios remotos',
|
||||
repositoryInformation: 'Informações do Repositório',
|
||||
currentBranch: 'Branch Atual',
|
||||
totalCommits: 'Total de Commits',
|
||||
latestCommit: 'Último Commit',
|
||||
remotes: 'Remotos',
|
||||
notGitRepository: 'Não é um repositório Git',
|
||||
gitAuthentication: 'Autenticação',
|
||||
credentialsDescription: 'Credenciais para operações de push/pull',
|
||||
configured: 'Configurado',
|
||||
noCredentials: 'Sem credenciais',
|
||||
noCredentialsWarning: 'Nenhuma credencial configurada para {{provider}}. Operações de push/pull podem falhar para repositórios privados.',
|
||||
configureCredentials: 'Configurar credenciais',
|
||||
syncStatus: 'Status de Sincronização',
|
||||
pull: 'Pull',
|
||||
push: 'Push',
|
||||
pulling: 'Fazendo pull...',
|
||||
pushing: 'Fazendo push...',
|
||||
upToDate: 'Atualizado',
|
||||
commitsAhead: '{{count}} commit à frente | {{count}} commits à frente',
|
||||
commitsBehind: '{{count}} commit atrás | {{count}} commits atrás',
|
||||
uncommittedChanges: '{{count}} alteração não commitada | {{count}} alterações não commitadas',
|
||||
noRemoteConfigured: 'Nenhum remoto configurado',
|
||||
workingDirectoryChanges: 'Alterações do Diretório de Trabalho',
|
||||
filesWithChanges: '{{count}} arquivo com alterações | {{count}} arquivos com alterações',
|
||||
workingDirectoryClean: 'Diretório de trabalho limpo',
|
||||
noUncommittedChanges: 'Nenhuma alteração não commitada',
|
||||
cannotPush: 'Não é possível fazer push',
|
||||
cannotPull: 'Não é possível fazer pull',
|
||||
notGitRepoOrBranch: 'Não é um repositório git ou não há branch atual',
|
||||
noRemoteRepositories: 'Nenhum repositório remoto configurado',
|
||||
nothingToPush: 'Nada para fazer push',
|
||||
noCommitsAhead: 'Nenhum commit à frente do remoto. Faça commit de suas alterações primeiro.',
|
||||
pushSuccessful: 'Push realizado com sucesso',
|
||||
pushFailed: 'Push falhou',
|
||||
pullSuccessful: 'Pull realizado com sucesso',
|
||||
pullFailed: 'Pull falhou',
|
||||
|
||||
// AI Settings
|
||||
aiSettingsDescriptionLong: 'Configure provedores de IA adicionando suas chaves de API. As configurações são salvas automaticamente e armazenadas localmente em seu navegador.',
|
||||
configuredProviders: 'Provedores Configurados',
|
||||
addProvider: 'Adicionar Provedor',
|
||||
getApiKey: 'Obter chave de API',
|
||||
getToken: 'Obter token',
|
||||
enterApiKey: 'Digite sua chave de API',
|
||||
enterToken: 'Digite seu token',
|
||||
enterCashuToken: 'Digite um token Cashu',
|
||||
addCustomProvider: 'Adicionar Provedor Personalizado',
|
||||
providerName: 'Nome do Provedor',
|
||||
baseUrl: 'URL Base',
|
||||
apiKey: 'Chave de API',
|
||||
authentication: 'Autenticação',
|
||||
addCustomProviderButton: 'Adicionar Provedor Personalizado',
|
||||
providerExists: 'Provedor com este nome já existe',
|
||||
custom: 'Personalizado',
|
||||
connecting: 'Conectando...',
|
||||
connectToGitHub: 'Conectar ao GitHub',
|
||||
|
||||
// Git Settings
|
||||
gitSettingsDescriptionLong: 'Configure credenciais do Git para autenticação HTTP. As configurações são salvas automaticamente e armazenadas localmente em seu navegador.',
|
||||
configuredCredentials: 'Credenciais Configuradas',
|
||||
origin: 'Origem',
|
||||
username: 'Nome de usuário',
|
||||
password: 'Senha',
|
||||
enterPassword: 'Digite sua senha/token',
|
||||
credentialsExist: 'Credenciais para esta origem já existem',
|
||||
corsProxy: 'Proxy CORS',
|
||||
corsProxyDescription: 'Servidor proxy CORS usado para todas as operações Git com repositórios remotos. Necessário para operações Git baseadas no navegador.',
|
||||
|
||||
// Data Settings
|
||||
dataSettingsDescriptionLong: 'Exporte arquivos e gerencie dados locais.',
|
||||
exportFiles: 'Exportar Arquivos',
|
||||
exportFilesDescription: 'Baixe todos os seus projetos e arquivos como um arquivo ZIP. Isso inclui todos os arquivos de projeto, configurações e dados armazenados localmente.',
|
||||
exportAllFiles: 'Exportar Todos os Arquivos',
|
||||
exporting: 'Exportando...',
|
||||
clearAllData: 'Limpar Todos os Dados',
|
||||
clearAllDataDescription: 'Exclua permanentemente todos os dados locais, incluindo projetos, configurações e informações em cache. Esta ação não pode ser desfeita.',
|
||||
clearing: 'Limpando...',
|
||||
areYouSure: 'Você tem certeza absoluta?',
|
||||
clearDataWarning: 'Esta ação excluirá permanentemente todos os dados locais deste navegador, incluindo:',
|
||||
allProjects: 'Todos os projetos e seus arquivos',
|
||||
aiSettingsAndKeys: 'Configurações de IA e chaves de API',
|
||||
gitCredentialsSettings: 'Credenciais e configurações do Git',
|
||||
userPreferences: 'Preferências do usuário e temas',
|
||||
cachedData: 'Dados em cache e informações de sessão',
|
||||
actionCannotBeUndone: 'Esta ação não pode ser desfeita. Considere exportar seus arquivos primeiro.',
|
||||
yesClearAllData: 'Sim, limpar todos os dados',
|
||||
used: 'Usado',
|
||||
available: 'Disponível',
|
||||
usagePercentage: '{{percentage}}% usado',
|
||||
usageUnavailable: 'Porcentagem de uso indisponível',
|
||||
loadingStorageInfo: 'Carregando informações de armazenamento...',
|
||||
filesExportedSuccessfully: 'Arquivos exportados com sucesso',
|
||||
filesExportedDescription: 'Seus arquivos de projeto foram baixados como um arquivo zip.',
|
||||
failedToExportFiles: 'Falha ao exportar arquivos',
|
||||
dataClearedSuccessfully: 'Dados limpos com sucesso',
|
||||
dataClearedDescription: 'Todos os dados locais foram removidos. Redirecionando para a página inicial...',
|
||||
failedToClearData: 'Falha ao limpar dados',
|
||||
|
||||
// 404 Page
|
||||
pageNotFound: 'Ops! Página não encontrada',
|
||||
returnToHome: 'Voltar ao Início',
|
||||
|
||||
// Model Selector
|
||||
selectOrEnterModel: 'Selecione ou digite um modelo...',
|
||||
searchModels: 'Buscar modelos...',
|
||||
enterCustomModel: 'Digite modelo personalizado...',
|
||||
manageProviders: 'Gerenciar provedores...',
|
||||
noModelsFound: 'Nenhum modelo encontrado.',
|
||||
tryCustomModel: 'Tente usar um modelo personalizado.',
|
||||
recentlyUsed: 'Usados Recentemente',
|
||||
errorLoadingModels: 'Erro ao Carregar Modelos',
|
||||
|
||||
// Context and Cost
|
||||
contextUsage: 'Uso de contexto: {{tokens}} / {{total}} tokens ({{percentage}}%)',
|
||||
totalCostSession: 'Custo total para esta sessão de chat',
|
||||
|
||||
// File Status
|
||||
added: 'adicionado',
|
||||
deleted: 'excluído',
|
||||
modified: 'modificado',
|
||||
staged: 'preparado',
|
||||
untracked: 'não rastreado',
|
||||
|
||||
// Settings Layout
|
||||
toggleSidebar: 'Alternar barra lateral',
|
||||
openSidebar: 'Abrir barra lateral',
|
||||
|
||||
// Nostr Settings
|
||||
nostrSettingsDescriptionLong: 'Configure suas configurações de conexão Nostr e preferências de relay.',
|
||||
nostrAccounts: 'Contas Nostr',
|
||||
noAccountsLoggedIn: 'Nenhuma conta logada. Adicione uma conta para começar.',
|
||||
createAccount: 'Criar Conta',
|
||||
addExistingAccount: 'Adicionar Conta Existente',
|
||||
addAccount: 'Adicionar Conta',
|
||||
relayConfiguration: 'Configuração de Relay',
|
||||
selectedRelay: 'Relay Selecionado',
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
+27
-25
@@ -1,4 +1,5 @@
|
||||
import { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Check, Bot, ArrowLeft, Trash2 } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
@@ -79,6 +80,7 @@ const PRESET_PROVIDERS: PresetProvider[] = [
|
||||
];
|
||||
|
||||
export function AISettings() {
|
||||
const { t } = useTranslation();
|
||||
const { settings, addProvider, removeProvider, updateProvider } = useAISettings();
|
||||
const isMobile = useIsMobile();
|
||||
const navigate = useNavigate();
|
||||
@@ -154,15 +156,15 @@ export function AISettings() {
|
||||
className="h-8 w-auto px-2 -ml-2"
|
||||
>
|
||||
<ArrowLeft className="h-4 w-4 mr-2" />
|
||||
Back to Settings
|
||||
{t('backToSettings')}
|
||||
</Button>
|
||||
<div className="space-y-2">
|
||||
<h1 className="text-2xl font-bold flex items-center gap-3">
|
||||
<Bot className="h-6 w-6 text-primary" />
|
||||
AI Settings
|
||||
{t('aiSettings')}
|
||||
</h1>
|
||||
<p className="text-muted-foreground">
|
||||
Configure AI providers by adding your API keys. Settings are automatically saved and stored locally in your browser.
|
||||
{t('aiSettingsDescriptionLong')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -172,10 +174,10 @@ export function AISettings() {
|
||||
<div className="space-y-2">
|
||||
<h1 className="text-2xl font-bold flex items-center gap-3">
|
||||
<Bot className="h-6 w-6 text-primary" />
|
||||
AI Settings
|
||||
{t('aiSettings')}
|
||||
</h1>
|
||||
<p className="text-muted-foreground">
|
||||
Configure AI providers by adding your API keys. Settings are automatically saved and stored locally in your browser.
|
||||
{t('aiSettingsDescriptionLong')}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
@@ -184,7 +186,7 @@ export function AISettings() {
|
||||
{/* Configured Providers */}
|
||||
{configuredProviderIds.length > 0 && (
|
||||
<div className="space-y-3">
|
||||
<h4 className="text-sm font-medium">Configured Providers</h4>
|
||||
<h4 className="text-sm font-medium">{t('configuredProviders')}</h4>
|
||||
<Accordion type="multiple" className="w-full space-y-2">
|
||||
{configuredProviderIds.map((providerId) => {
|
||||
const preset = PRESET_PROVIDERS.find(p => p.id === providerId);
|
||||
@@ -199,7 +201,7 @@ export function AISettings() {
|
||||
<span className="font-medium">
|
||||
{preset?.name || providerId}
|
||||
</span>
|
||||
{isCustom && <Badge variant="outline">Custom</Badge>}
|
||||
{isCustom && <Badge variant="outline">{t('custom')}</Badge>}
|
||||
</div>
|
||||
<Button
|
||||
variant="ghost"
|
||||
@@ -217,7 +219,7 @@ export function AISettings() {
|
||||
<AccordionContent className="px-4 pb-4">
|
||||
<div className="space-y-3">
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor={`${providerId}-baseURL`}>Base URL</Label>
|
||||
<Label htmlFor={`${providerId}-baseURL`}>{t('baseUrl')}</Label>
|
||||
<Input
|
||||
id={`${providerId}-baseURL`}
|
||||
placeholder="https://api.example.com/v1"
|
||||
@@ -226,7 +228,7 @@ export function AISettings() {
|
||||
/>
|
||||
</div>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor={`${providerId}-auth`}>Authentication</Label>
|
||||
<Label htmlFor={`${providerId}-auth`}>{t('authentication')}</Label>
|
||||
<Select
|
||||
value={provider?.nostr ? 'nostr' : 'api-key'}
|
||||
onValueChange={(value: 'api-key' | 'nostr') => handleUpdateProvider(providerId, {
|
||||
@@ -238,17 +240,17 @@ export function AISettings() {
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="api-key">API Key</SelectItem>
|
||||
<SelectItem value="api-key">{t('apiKey')}</SelectItem>
|
||||
<SelectItem value="nostr">Nostr</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
{!provider?.nostr && (
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor={`${providerId}-apiKey`}>API Key</Label>
|
||||
<Label htmlFor={`${providerId}-apiKey`}>{t('apiKey')}</Label>
|
||||
<PasswordInput
|
||||
id={`${providerId}-apiKey`}
|
||||
placeholder="Enter your API key"
|
||||
placeholder={t('enterApiKey')}
|
||||
value={provider?.apiKey || ''}
|
||||
onChange={(e) => handleUpdateProvider(providerId, { apiKey: e.target.value })}
|
||||
/>
|
||||
@@ -268,7 +270,7 @@ export function AISettings() {
|
||||
{/* Available Preset Providers */}
|
||||
{availablePresets.length > 0 && (
|
||||
<div className="space-y-3">
|
||||
<h4 className="text-sm font-medium">Add Provider</h4>
|
||||
<h4 className="text-sm font-medium">{t('addProvider')}</h4>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||||
{availablePresets.map((preset) => (
|
||||
<div key={preset.id} className="border rounded-lg p-4 space-y-3">
|
||||
@@ -280,14 +282,14 @@ export function AISettings() {
|
||||
className="text-xs text-muted-foreground underline hover:text-foreground"
|
||||
onClick={() => window.open(preset.apiKeysURL, '_blank')}
|
||||
>
|
||||
Get API key
|
||||
{t('getApiKey')}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
{!preset.nostr && (
|
||||
<PasswordInput
|
||||
placeholder={preset.id === "routstr" ? "Enter a Cashu token" : "Enter your API key"}
|
||||
placeholder={preset.id === "routstr" ? t('enterCashuToken') : t('enterApiKey')}
|
||||
className="flex-1"
|
||||
value={presetApiKeys[preset.id] || ''}
|
||||
onChange={(e) => setPresetApiKeys(prev => ({
|
||||
@@ -306,7 +308,7 @@ export function AISettings() {
|
||||
disabled={!!preset.apiKeysURL && !presetApiKeys[preset.id]?.trim()}
|
||||
size="sm"
|
||||
>
|
||||
Add
|
||||
{t('add')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -322,12 +324,12 @@ export function AISettings() {
|
||||
<Accordion type="single" collapsible className="w-full">
|
||||
<AccordionItem value="custom-provider" className="border rounded-lg">
|
||||
<AccordionTrigger className="px-4 py-3 hover:no-underline">
|
||||
<h4 className="text-sm font-medium">Add Custom Provider</h4>
|
||||
<h4 className="text-sm font-medium">{t('addCustomProvider')}</h4>
|
||||
</AccordionTrigger>
|
||||
<AccordionContent className="px-4 pb-4">
|
||||
<div className="space-y-3">
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="custom-name">Provider Name</Label>
|
||||
<Label htmlFor="custom-name">{t('providerName')}</Label>
|
||||
<Input
|
||||
id="custom-name"
|
||||
placeholder="e.g., my-custom-api"
|
||||
@@ -336,7 +338,7 @@ export function AISettings() {
|
||||
/>
|
||||
</div>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="custom-baseurl">Base URL</Label>
|
||||
<Label htmlFor="custom-baseurl">{t('baseUrl')}</Label>
|
||||
<Input
|
||||
id="custom-baseurl"
|
||||
placeholder="https://api.example.com/v1"
|
||||
@@ -345,7 +347,7 @@ export function AISettings() {
|
||||
/>
|
||||
</div>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="custom-auth">Authentication</Label>
|
||||
<Label htmlFor="custom-auth">{t('authentication')}</Label>
|
||||
<Select
|
||||
value={customAuthMethod}
|
||||
onValueChange={(value: 'api-key' | 'nostr') => {
|
||||
@@ -359,17 +361,17 @@ export function AISettings() {
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="api-key">API Key</SelectItem>
|
||||
<SelectItem value="api-key">{t('apiKey')}</SelectItem>
|
||||
<SelectItem value="nostr">Nostr</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
{customAuthMethod === 'api-key' && (
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="custom-apikey">API Key</Label>
|
||||
<Label htmlFor="custom-apikey">{t('apiKey')}</Label>
|
||||
<PasswordInput
|
||||
id="custom-apikey"
|
||||
placeholder="Enter your API key (optional)"
|
||||
placeholder={t('enterApiKey') + ' (optional)'}
|
||||
value={customApiKey}
|
||||
onChange={(e) => setCustomApiKey(e.target.value)}
|
||||
/>
|
||||
@@ -386,11 +388,11 @@ export function AISettings() {
|
||||
className="gap-2"
|
||||
>
|
||||
<Check className="h-4 w-4" />
|
||||
Add Custom Provider
|
||||
{t('addCustomProviderButton')}
|
||||
</Button>
|
||||
{customProviderName.trim() in settings.providers && (
|
||||
<p className="text-sm text-destructive">
|
||||
Provider with this name already exists
|
||||
{t('providerExists')}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
+35
-33
@@ -1,5 +1,6 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Download, Trash2, AlertTriangle, Loader2, Database, Info } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
@@ -23,6 +24,7 @@ interface StorageInfo {
|
||||
}
|
||||
|
||||
export function DataSettings() {
|
||||
const { t } = useTranslation();
|
||||
const [isExporting, setIsExporting] = useState(false);
|
||||
const [isClearing, setIsClearing] = useState(false);
|
||||
const [storageInfo, setStorageInfo] = useState<StorageInfo | null>(null);
|
||||
@@ -130,14 +132,14 @@ export function DataSettings() {
|
||||
await exportFilesAsZip();
|
||||
|
||||
toast({
|
||||
title: "Files exported successfully",
|
||||
description: "Your project files have been downloaded as a zip file.",
|
||||
title: t('filesExportedSuccessfully'),
|
||||
description: t('filesExportedDescription'),
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Failed to export files:', error);
|
||||
toast({
|
||||
title: "Failed to export files",
|
||||
description: error instanceof Error ? error.message : "An unexpected error occurred",
|
||||
title: t('failedToExportFiles'),
|
||||
description: error instanceof Error ? error.message : t('error'),
|
||||
variant: "destructive",
|
||||
});
|
||||
} finally {
|
||||
@@ -172,8 +174,8 @@ export function DataSettings() {
|
||||
await Promise.all(deletePromises);
|
||||
|
||||
toast({
|
||||
title: "Data cleared successfully",
|
||||
description: "All local data has been removed. Redirecting to homepage...",
|
||||
title: t('dataClearedSuccessfully'),
|
||||
description: t('dataClearedDescription'),
|
||||
});
|
||||
|
||||
// Small delay to show the toast, then redirect
|
||||
@@ -183,8 +185,8 @@ export function DataSettings() {
|
||||
} catch (error) {
|
||||
console.error('Failed to clear data:', error);
|
||||
toast({
|
||||
title: "Failed to clear data",
|
||||
description: error instanceof Error ? error.message : "An unexpected error occurred",
|
||||
title: t('failedToClearData'),
|
||||
description: error instanceof Error ? error.message : t('error'),
|
||||
variant: "destructive",
|
||||
});
|
||||
} finally {
|
||||
@@ -197,10 +199,10 @@ export function DataSettings() {
|
||||
<div className="space-y-2">
|
||||
<h1 className="text-2xl font-bold flex items-center gap-3">
|
||||
<Database className="h-6 w-6 text-primary" />
|
||||
Data
|
||||
{t('dataSettings')}
|
||||
</h1>
|
||||
<p className="text-muted-foreground">
|
||||
Export files and manage local data.
|
||||
{t('dataSettingsDescriptionLong')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -216,8 +218,8 @@ export function DataSettings() {
|
||||
{/* Usage Progress */}
|
||||
<div className="space-y-2">
|
||||
<div className="flex justify-between items-center text-sm">
|
||||
<span>Used: {formatBytes(storageInfo.usage)}</span>
|
||||
<span>Available: {formatBytes(storageInfo.quota)}</span>
|
||||
<span>{t('used')}: {formatBytes(storageInfo.usage)}</span>
|
||||
<span>{t('available')}: {formatBytes(storageInfo.quota)}</span>
|
||||
</div>
|
||||
<Progress
|
||||
value={storageInfo.quota > 0 ? (storageInfo.usage / storageInfo.quota) * 100 : 0}
|
||||
@@ -225,8 +227,8 @@ export function DataSettings() {
|
||||
/>
|
||||
<div className="text-xs text-muted-foreground text-center">
|
||||
{storageInfo.quota > 0
|
||||
? `${((storageInfo.usage / storageInfo.quota) * 100).toFixed(1)}% used`
|
||||
: 'Usage percentage unavailable'
|
||||
? t('usagePercentage', { percentage: ((storageInfo.usage / storageInfo.quota) * 100).toFixed(1) })
|
||||
: t('usageUnavailable')
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -235,7 +237,7 @@ export function DataSettings() {
|
||||
) : (
|
||||
<div className="flex items-center gap-2 text-muted-foreground">
|
||||
<Loader2 className="h-4 w-4 animate-spin" />
|
||||
<span className="text-sm">Loading storage information...</span>
|
||||
<span className="text-sm">{t('loadingStorageInfo')}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -244,10 +246,10 @@ export function DataSettings() {
|
||||
<CardHeader>
|
||||
<CardTitle className="flex items-center gap-2">
|
||||
<Download className="h-5 w-5" />
|
||||
Export Files
|
||||
{t('exportFiles')}
|
||||
</CardTitle>
|
||||
<CardDescription>
|
||||
Download all your projects and files as a ZIP archive. This includes all project files, settings, and data stored locally.
|
||||
{t('exportFilesDescription')}
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
@@ -259,12 +261,12 @@ export function DataSettings() {
|
||||
{isExporting ? (
|
||||
<>
|
||||
<Loader2 className="h-4 w-4 mr-2 animate-spin" />
|
||||
Exporting...
|
||||
{t('exporting')}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Download className="h-4 w-4 mr-2" />
|
||||
Export All Files
|
||||
{t('exportAllFiles')}
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
@@ -276,10 +278,10 @@ export function DataSettings() {
|
||||
<CardHeader>
|
||||
<CardTitle className="flex items-center gap-2 text-destructive">
|
||||
<Trash2 className="h-5 w-5" />
|
||||
Clear All Data
|
||||
{t('clearAllData')}
|
||||
</CardTitle>
|
||||
<CardDescription>
|
||||
Permanently delete all local data including projects, settings, and cached information. This action cannot be undone.
|
||||
{t('clearAllDataDescription')}
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
@@ -293,12 +295,12 @@ export function DataSettings() {
|
||||
{isClearing ? (
|
||||
<>
|
||||
<Loader2 className="h-4 w-4 mr-2 animate-spin" />
|
||||
Clearing...
|
||||
{t('clearing')}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Trash2 className="h-4 w-4 mr-2" />
|
||||
Clear All Data
|
||||
{t('clearAllData')}
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
@@ -307,31 +309,31 @@ export function DataSettings() {
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle className="flex items-center gap-2">
|
||||
<AlertTriangle className="h-5 w-5 text-destructive" />
|
||||
Are you absolutely sure?
|
||||
{t('areYouSure')}
|
||||
</AlertDialogTitle>
|
||||
<AlertDialogDescription className="space-y-2">
|
||||
<p>
|
||||
This action will permanently delete all local data from this browser, including:
|
||||
{t('clearDataWarning')}
|
||||
</p>
|
||||
<ul className="list-disc list-inside space-y-1 text-sm">
|
||||
<li>All projects and their files</li>
|
||||
<li>AI settings and API keys</li>
|
||||
<li>Git credentials and settings</li>
|
||||
<li>User preferences and themes</li>
|
||||
<li>Cached data and session information</li>
|
||||
<li>{t('allProjects')}</li>
|
||||
<li>{t('aiSettingsAndKeys')}</li>
|
||||
<li>{t('gitCredentialsSettings')}</li>
|
||||
<li>{t('userPreferences')}</li>
|
||||
<li>{t('cachedData')}</li>
|
||||
</ul>
|
||||
<p className="font-medium text-destructive">
|
||||
This action cannot be undone. Consider exporting your files first.
|
||||
{t('actionCannotBeUndone')}
|
||||
</p>
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||
<AlertDialogCancel>{t('cancel')}</AlertDialogCancel>
|
||||
<AlertDialogAction
|
||||
onClick={handleClearAllData}
|
||||
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
|
||||
>
|
||||
Yes, clear all data
|
||||
{t('yesClearAllData')}
|
||||
</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
|
||||
+28
-26
@@ -1,4 +1,5 @@
|
||||
import { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Check, GitBranch, ArrowLeft, Github, Trash2 } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
@@ -38,6 +39,7 @@ const PRESET_PROVIDERS: PresetProvider[] = [
|
||||
];
|
||||
|
||||
export function GitSettings() {
|
||||
const { t } = useTranslation();
|
||||
const { settings, addCredential, removeCredential, updateCredential, updateSettings } = useGitSettings();
|
||||
const { initiateOAuth, isLoading: isOAuthLoading, error: oauthError, isOAuthConfigured } = useGitHubOAuth();
|
||||
const isMobile = useIsMobile();
|
||||
@@ -107,15 +109,15 @@ export function GitSettings() {
|
||||
className="h-8 w-auto px-2 -ml-2"
|
||||
>
|
||||
<ArrowLeft className="h-4 w-4 mr-2" />
|
||||
Back to Settings
|
||||
{t('backToSettings')}
|
||||
</Button>
|
||||
<div className="space-y-2">
|
||||
<h1 className="text-2xl font-bold flex items-center gap-3">
|
||||
<GitBranch className="h-6 w-6 text-primary" />
|
||||
Git Settings
|
||||
{t('gitSettings')}
|
||||
</h1>
|
||||
<p className="text-muted-foreground">
|
||||
Configure Git credentials for HTTP authentication. Settings are automatically saved and stored locally in your browser.
|
||||
{t('gitSettingsDescriptionLong')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -125,10 +127,10 @@ export function GitSettings() {
|
||||
<div className="space-y-2">
|
||||
<h1 className="text-2xl font-bold flex items-center gap-3">
|
||||
<GitBranch className="h-6 w-6 text-primary" />
|
||||
Git Settings
|
||||
{t('gitSettings')}
|
||||
</h1>
|
||||
<p className="text-muted-foreground">
|
||||
Configure Git credentials for HTTP authentication. Settings are automatically saved and stored locally in your browser.
|
||||
{t('gitSettingsDescriptionLong')}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
@@ -137,7 +139,7 @@ export function GitSettings() {
|
||||
{/* Configured Credentials */}
|
||||
{configuredOrigins.length > 0 && (
|
||||
<div className="space-y-3">
|
||||
<h4 className="text-sm font-medium">Configured Credentials</h4>
|
||||
<h4 className="text-sm font-medium">{t('configuredCredentials')}</h4>
|
||||
<Accordion type="multiple" className="w-full space-y-2">
|
||||
{configuredOrigins.map((origin) => {
|
||||
const preset = PRESET_PROVIDERS.find(p => p.origin === origin);
|
||||
@@ -152,7 +154,7 @@ export function GitSettings() {
|
||||
<span className="font-medium">
|
||||
{preset?.name || new URL(origin).hostname}
|
||||
</span>
|
||||
{isCustom && <Badge variant="outline">Custom</Badge>}
|
||||
{isCustom && <Badge variant="outline">{t('custom')}</Badge>}
|
||||
</div>
|
||||
<Button
|
||||
variant="ghost"
|
||||
@@ -170,7 +172,7 @@ export function GitSettings() {
|
||||
<AccordionContent className="px-4 pb-4">
|
||||
<div className="space-y-3">
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor={`${origin}-origin`}>Origin</Label>
|
||||
<Label htmlFor={`${origin}-origin`}>{t('origin')}</Label>
|
||||
<Input
|
||||
id={`${origin}-origin`}
|
||||
placeholder="https://github.com"
|
||||
@@ -180,7 +182,7 @@ export function GitSettings() {
|
||||
/>
|
||||
</div>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor={`${origin}-username`}>Username</Label>
|
||||
<Label htmlFor={`${origin}-username`}>{t('username')}</Label>
|
||||
<Input
|
||||
id={`${origin}-username`}
|
||||
placeholder="git"
|
||||
@@ -189,11 +191,11 @@ export function GitSettings() {
|
||||
/>
|
||||
</div>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor={`${origin}-password`}>Password</Label>
|
||||
<Label htmlFor={`${origin}-password`}>{t('password')}</Label>
|
||||
<Input
|
||||
id={`${origin}-password`}
|
||||
type="password"
|
||||
placeholder="Enter your password/token"
|
||||
placeholder={t('enterPassword')}
|
||||
value={credential?.password || ''}
|
||||
onChange={(e) => handleUpdateCredential(origin, { password: e.target.value })}
|
||||
/>
|
||||
@@ -212,7 +214,7 @@ export function GitSettings() {
|
||||
{/* Available Preset Providers */}
|
||||
{availablePresets.length > 0 && (
|
||||
<div className="space-y-3">
|
||||
<h4 className="text-sm font-medium">Add Provider</h4>
|
||||
<h4 className="text-sm font-medium">{t('addProvider')}</h4>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||||
{availablePresets.map((preset) => (
|
||||
<div key={preset.id} className="border rounded-lg p-4 space-y-3">
|
||||
@@ -224,7 +226,7 @@ export function GitSettings() {
|
||||
className="text-xs text-muted-foreground underline hover:text-foreground"
|
||||
onClick={() => window.open(preset.tokenURL, '_blank')}
|
||||
>
|
||||
Get token
|
||||
{t('getToken')}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -262,7 +264,7 @@ export function GitSettings() {
|
||||
) : (
|
||||
<div className="flex gap-2">
|
||||
<Input
|
||||
placeholder="Enter your token"
|
||||
placeholder={t('enterToken')}
|
||||
type="password"
|
||||
className="flex-1"
|
||||
value={presetTokens[preset.id] || ''}
|
||||
@@ -281,7 +283,7 @@ export function GitSettings() {
|
||||
disabled={!presetTokens[preset.id]?.trim()}
|
||||
size="sm"
|
||||
>
|
||||
Add
|
||||
{t('add')}
|
||||
</Button>
|
||||
</div>
|
||||
)
|
||||
@@ -289,7 +291,7 @@ export function GitSettings() {
|
||||
// Standard rendering for other providers
|
||||
<div className="flex gap-2">
|
||||
<Input
|
||||
placeholder="Enter your token"
|
||||
placeholder={t('enterToken')}
|
||||
type="password"
|
||||
className="flex-1"
|
||||
value={presetTokens[preset.id] || ''}
|
||||
@@ -308,7 +310,7 @@ export function GitSettings() {
|
||||
disabled={!presetTokens[preset.id]?.trim()}
|
||||
size="sm"
|
||||
>
|
||||
Add
|
||||
{t('add')}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
@@ -325,12 +327,12 @@ export function GitSettings() {
|
||||
<Accordion type="single" collapsible className="w-full">
|
||||
<AccordionItem value="custom-provider" className="border rounded-lg">
|
||||
<AccordionTrigger className="px-4 py-3 hover:no-underline">
|
||||
<h4 className="text-sm font-medium">Add Custom Provider</h4>
|
||||
<h4 className="text-sm font-medium">{t('addCustomProvider')}</h4>
|
||||
</AccordionTrigger>
|
||||
<AccordionContent className="px-4 pb-4">
|
||||
<div className="space-y-3">
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="custom-origin">Origin</Label>
|
||||
<Label htmlFor="custom-origin">{t('origin')}</Label>
|
||||
<Input
|
||||
id="custom-origin"
|
||||
placeholder="https://git.example.com"
|
||||
@@ -339,7 +341,7 @@ export function GitSettings() {
|
||||
/>
|
||||
</div>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="custom-username">Username</Label>
|
||||
<Label htmlFor="custom-username">{t('username')}</Label>
|
||||
<Input
|
||||
id="custom-username"
|
||||
placeholder="git"
|
||||
@@ -348,11 +350,11 @@ export function GitSettings() {
|
||||
/>
|
||||
</div>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="custom-password">Password</Label>
|
||||
<Label htmlFor="custom-password">{t('password')}</Label>
|
||||
<Input
|
||||
id="custom-password"
|
||||
type="password"
|
||||
placeholder="Enter your password/token"
|
||||
placeholder={t('enterPassword')}
|
||||
value={customPassword}
|
||||
onChange={(e) => setCustomPassword(e.target.value)}
|
||||
/>
|
||||
@@ -369,11 +371,11 @@ export function GitSettings() {
|
||||
className="gap-2"
|
||||
>
|
||||
<Check className="h-4 w-4" />
|
||||
Add Custom Provider
|
||||
{t('addCustomProviderButton')}
|
||||
</Button>
|
||||
{customOrigin.trim() in settings.credentials && (
|
||||
<p className="text-sm text-destructive">
|
||||
Credentials for this origin already exist
|
||||
{t('credentialsExist')}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
@@ -385,7 +387,7 @@ export function GitSettings() {
|
||||
<Accordion type="single" collapsible className="w-full">
|
||||
<AccordionItem value="cors-proxy" className="border rounded-lg">
|
||||
<AccordionTrigger className="px-4 py-3 hover:no-underline">
|
||||
<h4 className="text-sm font-medium">CORS Proxy</h4>
|
||||
<h4 className="text-sm font-medium">{t('corsProxy')}</h4>
|
||||
</AccordionTrigger>
|
||||
<AccordionContent className="px-4 pb-4">
|
||||
<div className="space-y-3">
|
||||
@@ -397,7 +399,7 @@ export function GitSettings() {
|
||||
onChange={(e) => updateSettings({ corsProxy: e.target.value })}
|
||||
/>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
CORS proxy server used for all Git operations with remote repositories. Required for browser-based Git operations.
|
||||
{t('corsProxyDescription')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+9
-7
@@ -1,5 +1,6 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useProjectsManager } from '@/hooks/useProjectsManager';
|
||||
import { useAIProjectId } from '@/hooks/useAIProjectId';
|
||||
import { useFS } from '@/hooks/useFS';
|
||||
@@ -17,6 +18,7 @@ import { Plus } from 'lucide-react';
|
||||
import { useSeoMeta } from '@unhead/react';
|
||||
|
||||
export default function Index() {
|
||||
const { t } = useTranslation();
|
||||
const [prompt, setPrompt] = useState('');
|
||||
const [isCreating, setIsCreating] = useState(false);
|
||||
const [storedPrompt, setStoredPrompt] = useLocalStorage('shakespeare-draft-prompt', '');
|
||||
@@ -127,10 +129,10 @@ export default function Index() {
|
||||
<div className="text-center mb-8 md:mb-12">
|
||||
<div className="text-4xl md:text-6xl mb-4 md:mb-6">🎭</div>
|
||||
<h1 className="text-3xl md:text-4xl font-bold mb-3 md:mb-4 bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">
|
||||
Build Nostr apps with AI
|
||||
{t('buildNostrApps')}
|
||||
</h1>
|
||||
<p className="text-lg md:text-xl text-muted-foreground">
|
||||
What would you like to build?
|
||||
{t('whatToBuild')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -140,8 +142,8 @@ export default function Index() {
|
||||
<Textarea
|
||||
placeholder={
|
||||
!providerModel.trim()
|
||||
? "Please select a model below, then describe what you'd like to build..."
|
||||
: "e.g., Create a farming equipment marketplace for local farmers to buy and sell tractors, tools, and supplies..."
|
||||
? t('selectModelToDescribe')
|
||||
: t('examplePrompt')
|
||||
}
|
||||
value={prompt}
|
||||
onChange={handlePromptChange}
|
||||
@@ -169,7 +171,7 @@ export default function Index() {
|
||||
onChange={setProviderModel}
|
||||
className="w-full"
|
||||
disabled={isCreating || isGeneratingId}
|
||||
placeholder="Choose a model..."
|
||||
placeholder={t('chooseModel')}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -188,12 +190,12 @@ export default function Index() {
|
||||
{isCreating || isGeneratingId ? (
|
||||
<>
|
||||
<div className="animate-spin rounded-full h-3 w-3 border-b-2 border-white mr-2"></div>
|
||||
{isGeneratingId ? 'Generating...' : 'Creating...'}
|
||||
{isGeneratingId ? t('generating') : t('creating')}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Plus className="mr-2 h-3 w-3" />
|
||||
Create Project
|
||||
{t('createProject')}
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
|
||||
+14
-12
@@ -1,4 +1,5 @@
|
||||
import { ArrowLeft, Wifi, Users, UserPlus, LogOut, Trash2, User, Plus } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
@@ -14,6 +15,7 @@ import { genUserName } from '@/lib/genUserName';
|
||||
import { useState } from 'react';
|
||||
|
||||
export function NostrSettings() {
|
||||
const { t } = useTranslation();
|
||||
const isMobile = useIsMobile();
|
||||
const navigate = useNavigate();
|
||||
const { authors, currentUser, setLogin, removeLogin, isLoading } = useLoggedInAccounts();
|
||||
@@ -51,15 +53,15 @@ export function NostrSettings() {
|
||||
className="h-8 w-auto px-2 -ml-2"
|
||||
>
|
||||
<ArrowLeft className="h-4 w-4 mr-2" />
|
||||
Back to Settings
|
||||
{t('backToSettings')}
|
||||
</Button>
|
||||
<div className="space-y-2">
|
||||
<h1 className="text-2xl font-bold flex items-center gap-3">
|
||||
<Wifi className="h-6 w-6 text-primary" />
|
||||
Nostr Settings
|
||||
{t('nostrSettings')}
|
||||
</h1>
|
||||
<p className="text-muted-foreground">
|
||||
Configure your Nostr connection settings and relay preferences.
|
||||
{t('nostrSettingsDescriptionLong')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -69,10 +71,10 @@ export function NostrSettings() {
|
||||
<div className="space-y-2">
|
||||
<h1 className="text-2xl font-bold flex items-center gap-3">
|
||||
<Wifi className="h-6 w-6 text-primary" />
|
||||
Nostr Settings
|
||||
{t('nostrSettings')}
|
||||
</h1>
|
||||
<p className="text-muted-foreground">
|
||||
Configure your Nostr connection settings and relay preferences.
|
||||
{t('nostrSettingsDescriptionLong')}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
@@ -83,7 +85,7 @@ export function NostrSettings() {
|
||||
<CardHeader>
|
||||
<CardTitle className="flex items-center gap-2">
|
||||
<Users className="h-5 w-5" />
|
||||
Nostr Accounts
|
||||
{t('nostrAccounts')}
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
@@ -111,16 +113,16 @@ export function NostrSettings() {
|
||||
<div className="text-center py-8">
|
||||
<User className="h-12 w-12 mx-auto text-muted-foreground mb-4" />
|
||||
<p className="text-muted-foreground mb-4">
|
||||
No accounts logged in. Add an account to get started.
|
||||
{t('noAccountsLoggedIn')}
|
||||
</p>
|
||||
<div className="flex flex-col sm:flex-row gap-2 justify-center">
|
||||
<Button onClick={() => setShowSignupDialog(true)} className="gap-2">
|
||||
<UserPlus className="h-4 w-4" />
|
||||
Create Account
|
||||
{t('createAccount')}
|
||||
</Button>
|
||||
<Button variant="outline" onClick={() => setShowLoginDialog(true)} className="gap-2">
|
||||
<LogOut className="h-4 w-4 rotate-180" />
|
||||
Add Existing Account
|
||||
{t('addExistingAccount')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -177,7 +179,7 @@ export function NostrSettings() {
|
||||
</div>
|
||||
<div className="flex-1 min-w-0">
|
||||
<p className="font-medium text-muted-foreground">
|
||||
Add Account
|
||||
{t('addAccount')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -192,12 +194,12 @@ export function NostrSettings() {
|
||||
<CardHeader>
|
||||
<CardTitle className="flex items-center gap-2">
|
||||
<Wifi className="h-5 w-5" />
|
||||
Relay Configuration
|
||||
{t('relayConfiguration')}
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="relay-selector">Selected Relay</Label>
|
||||
<Label htmlFor="relay-selector">{t('selectedRelay')}</Label>
|
||||
<RelaySelector className="w-full max-w-md" />
|
||||
</div>
|
||||
</CardContent>
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { useSeoMeta } from "@unhead/react";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useEffect } from "react";
|
||||
|
||||
const NotFound = () => {
|
||||
const { t } = useTranslation();
|
||||
const location = useLocation();
|
||||
|
||||
useSeoMeta({
|
||||
@@ -21,9 +23,9 @@ const NotFound = () => {
|
||||
<div className="min-h-screen flex items-center justify-center bg-background">
|
||||
<div className="text-center">
|
||||
<h1 className="text-4xl font-bold mb-4 text-foreground">404</h1>
|
||||
<p className="text-xl text-muted-foreground mb-4">Oops! Page not found</p>
|
||||
<p className="text-xl text-muted-foreground mb-4">{t('pageNotFound')}</p>
|
||||
<a href="/" className="text-primary hover:text-primary/80 underline">
|
||||
Return to Home
|
||||
{t('returnToHome')}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -29,7 +29,7 @@ export function Preferences() {
|
||||
<div className="space-y-2">
|
||||
<h1 className="text-2xl font-bold flex items-center gap-3">
|
||||
<Settings2 className="h-6 w-6 text-primary" />
|
||||
{t('preferencesTitle')}
|
||||
{t('preferences')}
|
||||
</h1>
|
||||
<p className="text-muted-foreground">
|
||||
{t('preferencesDescription')}
|
||||
@@ -42,7 +42,7 @@ export function Preferences() {
|
||||
<div className="space-y-2">
|
||||
<h1 className="text-2xl font-bold flex items-center gap-3">
|
||||
<Settings2 className="h-6 w-6 text-primary" />
|
||||
{t('preferencesTitle')}
|
||||
{t('preferences')}
|
||||
</h1>
|
||||
<p className="text-muted-foreground">
|
||||
{t('preferencesDescription')}
|
||||
|
||||
@@ -61,7 +61,7 @@ export function Settings() {
|
||||
return (
|
||||
<div className="p-6 space-y-4">
|
||||
<div className="space-y-2">
|
||||
<h2 className="text-xl font-bold">{t('settingsTitle')}</h2>
|
||||
<h2 className="text-xl font-bold">{t('settings')}</h2>
|
||||
<p className="text-muted-foreground">
|
||||
{t('settingsDescription')}
|
||||
</p>
|
||||
|
||||
Reference in new issue
Block a user