fix: simplify login screens
This commit is contained in:
1 parent
e0870144a8
commit
cf2143d5e5
7 files changed
+12
-51
No files matched your search
@@ -34,6 +34,7 @@ struct LoginView: View {
|
||||
.clipShape(Circle())
|
||||
.overlay(Circle().stroke(AppTheme.border, lineWidth: 1))
|
||||
}
|
||||
.accessibilityLabel(env.preferences.t("GitHub 仓库", en: "GitHub repository"))
|
||||
.padding(.trailing, 18)
|
||||
.padding(.top, 18)
|
||||
.zIndex(2)
|
||||
@@ -70,23 +71,6 @@ struct LoginView: View {
|
||||
keyboard: .URL,
|
||||
secure: false
|
||||
)
|
||||
Text(env.preferences.t(
|
||||
"请填写完整 HTTPS 地址,不要只输入 demo。",
|
||||
en: "Enter the full HTTPS URL, not just “demo”."
|
||||
))
|
||||
.font(.system(size: 12, weight: .medium))
|
||||
.foregroundStyle(AppTheme.secondary)
|
||||
.padding(.top, 8)
|
||||
Button {
|
||||
baseUrl = EdgeEverPublicDemo.instanceURLString
|
||||
} label: {
|
||||
Text(env.preferences.t("填入公开演示实例", en: "Use public demo instance"))
|
||||
.font(.system(size: 13, weight: .semibold))
|
||||
.foregroundStyle(AppTheme.accent)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.accessibilityLabel(env.preferences.t("填入公开演示实例", en: "Use public demo instance"))
|
||||
.padding(.top, 6)
|
||||
.padding(.bottom, 14)
|
||||
|
||||
field(
|
||||
|
||||
@@ -41,6 +41,7 @@ export const FileSpreadsheet = createIcon("grid");
|
||||
export const FileText = createIcon("file-text");
|
||||
export const Folder = createIcon("folder");
|
||||
export const Grid = createIcon("grid");
|
||||
export const GitHub = createIcon("github");
|
||||
export const HardDrive = createIcon("hard-drive");
|
||||
export const Heading2 = createIcon("type");
|
||||
export const History = createIcon("clock");
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
} from "react-native";
|
||||
import { PUBLIC_DEMO_INSTANCE_URL } from "@edgeever/shared";
|
||||
import { SafeAreaView } from "react-native-safe-area-context";
|
||||
import { ActivityIndicator, ExternalLink, LockKeyhole } from "../components/icons";
|
||||
import { ActivityIndicator, GitHub, LockKeyhole } from "../components/icons";
|
||||
import { Pressable, Text, TextInput } from "../components/LocalizedText";
|
||||
import { resolveMobileThemeStyles, useMobileTheme, type MobileResolvedTheme } from "../lib/mobile-theme";
|
||||
import { useSession } from "../lib/session";
|
||||
@@ -48,7 +48,7 @@ export const LoginScreen = () => {
|
||||
return (
|
||||
<SafeAreaView style={styles.safeArea}>
|
||||
<Pressable accessibilityLabel="GitHub 仓库" accessibilityRole="link" onPress={() => Linking.openURL(GITHUB_REPOSITORY_URL)} style={styles.githubButton}>
|
||||
<ExternalLink color="#475569" size={20} />
|
||||
<GitHub color="#475569" size={20} />
|
||||
</Pressable>
|
||||
<KeyboardAvoidingView behavior={Platform.OS === "ios" ? "padding" : undefined} style={styles.keyboard}>
|
||||
<ScrollView
|
||||
@@ -78,14 +78,6 @@ export const LoginScreen = () => {
|
||||
style={styles.input}
|
||||
value={baseUrl}
|
||||
/>
|
||||
<Text style={styles.hint}>请填写完整 HTTPS 地址,不要只输入 demo。</Text>
|
||||
<Pressable
|
||||
accessibilityLabel="填入公开演示实例"
|
||||
accessibilityRole="button"
|
||||
onPress={() => setBaseUrl(PUBLIC_DEMO_INSTANCE_URL)}
|
||||
>
|
||||
<Text style={styles.demoLink}>填入公开演示实例</Text>
|
||||
</Pressable>
|
||||
</View>
|
||||
|
||||
<View style={styles.field}>
|
||||
@@ -217,16 +209,6 @@ const baseLoginStyles = StyleSheet.create({
|
||||
minHeight: 48,
|
||||
paddingHorizontal: 14,
|
||||
},
|
||||
hint: {
|
||||
color: "#64748b",
|
||||
fontSize: 12,
|
||||
lineHeight: 16,
|
||||
},
|
||||
demoLink: {
|
||||
color: "#059669",
|
||||
fontSize: 13,
|
||||
fontWeight: "700",
|
||||
},
|
||||
error: {
|
||||
color: "#dc2626",
|
||||
fontSize: 13,
|
||||
|
||||
@@ -31,7 +31,13 @@ export const GitHubRepositoryLink = ({
|
||||
<TooltipProvider delayDuration={0} skipDelayDuration={0}>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<a className={cn("inline-flex items-center gap-2", className)} href={GITHUB_REPOSITORY_URL} target="_blank" rel="noopener noreferrer" title="" aria-label={children ? undefined : resolvedTitle}>
|
||||
<a
|
||||
aria-label={children ? undefined : resolvedTitle}
|
||||
className={cn("inline-flex items-center gap-2", className)}
|
||||
href={GITHUB_REPOSITORY_URL}
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
<GitHubMark className={cn("h-4 w-4 shrink-0", iconClassName)} />
|
||||
{children}
|
||||
</a>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useState, type FormEvent } from "react";
|
||||
import { LockKeyhole } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { PUBLIC_DEMO_INSTANCE_URL, resolveInstanceUrlInput } from "@edgeever/shared";
|
||||
import { resolveInstanceUrlInput } from "@edgeever/shared";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { GitHubRepositoryLink } from "@/components/GitHubRepositoryLink";
|
||||
import { Input } from "@/components/ui/input";
|
||||
@@ -92,14 +92,6 @@ export const LoginScreen = ({ error, instanceUrl: initialInstanceUrl, isSubmitti
|
||||
value={instanceUrl}
|
||||
onChange={(event) => setInstanceUrl(event.target.value)}
|
||||
/>
|
||||
<p className="mt-2 text-xs font-medium text-slate-500">{t("login.instanceUrlHint")}</p>
|
||||
<button
|
||||
className="mt-1.5 text-sm font-semibold text-emerald-700 transition hover:text-emerald-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500/70"
|
||||
type="button"
|
||||
onClick={() => setInstanceUrl(PUBLIC_DEMO_INSTANCE_URL)}
|
||||
>
|
||||
{t("login.usePublicDemo")}
|
||||
</button>
|
||||
</label>
|
||||
) : null}
|
||||
|
||||
|
||||
@@ -74,8 +74,6 @@ export const enUS = {
|
||||
desktopChangeInstance: "Change instance URL",
|
||||
desktopInstanceUrlInvalid: "Enter a valid instance URL beginning with http:// or https://.",
|
||||
instanceUrlPlaceholder: "https://demo.edgeever.org",
|
||||
instanceUrlHint: "Enter the full HTTPS URL, not just “demo”.",
|
||||
usePublicDemo: "Use public demo instance",
|
||||
},
|
||||
nav: {
|
||||
mobileMain: "Mobile primary navigation",
|
||||
|
||||
@@ -74,8 +74,6 @@ export const zhCN = {
|
||||
desktopChangeInstance: "更换实例地址",
|
||||
desktopInstanceUrlInvalid: "请输入以 http:// 或 https:// 开头的有效实例地址。",
|
||||
instanceUrlPlaceholder: "https://demo.edgeever.org",
|
||||
instanceUrlHint: "请填写完整 HTTPS 地址,不要只输入 demo。",
|
||||
usePublicDemo: "填入公开演示实例",
|
||||
},
|
||||
nav: {
|
||||
mobileMain: "移动端主导航",
|
||||
|
||||
Reference in new issue
Block a user