mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Translate all the strings
This commit is contained in:
17 files changed
+569
-191
No files matched your search
+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