Skip to content

Commit

Permalink
optimize for dark mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nikgraf committed Jun 12, 2024
1 parent c9fadfe commit dc4f962
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 81 deletions.
2 changes: 1 addition & 1 deletion apps/app/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"userInterfaceStyle": "light",
"userInterfaceStyle": "dark",
"splash": {
"image": "./assets/images/splash.png",
"resizeMode": "contain",
Expand Down
82 changes: 42 additions & 40 deletions apps/app/src/app/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,50 +15,52 @@ const Login = () => {
const { redirect } = useLocalSearchParams<{ redirect?: string }>();

return (
<View className="max-w-md mr-auto ml-auto min-w-80 mt-32">
<AuthForm
onSubmit={async ({ password, username }) => {
const loginResult = await login({
userIdentifier: username,
password,
});
if (loginResult === null) {
setError("Failed to login");
return;
}
const lockerKey = deriveKey({
context: "userLocker",
key: loginResult.exportKey,
subkeyId: "1D4xb6ADE6j67ZttH7cj7Q",
});
setSessionKey(loginResult.sessionKey);
setLockerKey(lockerKey.key);
<View className="bg-background flex-1">
<View className="max-w-md mr-auto ml-auto min-w-80 mt-32">
<AuthForm
onSubmit={async ({ password, username }) => {
const loginResult = await login({
userIdentifier: username,
password,
});
if (loginResult === null) {
setError("Failed to login");
return;
}
const lockerKey = deriveKey({
context: "userLocker",
key: loginResult.exportKey,
subkeyId: "1D4xb6ADE6j67ZttH7cj7Q",
});
setSessionKey(loginResult.sessionKey);
setLockerKey(lockerKey.key);

if (redirect) {
router.navigate(redirect);
return;
}
router.navigate("/");
}}
children="Login"
isPending={isPending}
/>
if (redirect) {
router.navigate(redirect);
return;
}
router.navigate("/");
}}
children="Login"
isPending={isPending}
/>

{error && (
<View className="mt-4">
<View className="flex flex-row items-center gap-1">
<AlertCircle className="h-4 w-4" />
{/* TODO proper styling */}
<Text>Error</Text>
{error && (
<View className="mt-4">
<View className="flex flex-row items-center gap-1">
<AlertCircle className="h-4 w-4" />
{/* TODO proper styling */}
<Text>Error</Text>
</View>
<Text>Failed to log in</Text>
</View>
<Text>Failed to log in</Text>
</View>
)}
)}

<View className="mt-8 text-center">
<Link href="/register" className="text-center">
<Text>Sign up here</Text>
</Link>
<View className="mt-8 text-center">
<Link href="/register" className="text-center">
<Text>Sign up here</Text>
</Link>
</View>
</View>
</View>
);
Expand Down
82 changes: 42 additions & 40 deletions apps/app/src/app/register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,49 +15,51 @@ const Register = () => {
const [error, setError] = useState<string | null>(null);

return (
<View className="max-w-md mr-auto ml-auto min-w-80 mt-32">
<AuthForm
onSubmit={async ({ password, username }) => {
const result = await registerAndLogin({
userIdentifier: username,
password,
});
if (!result) {
setError("Failed to register");
return;
}
const lockerKey = deriveKey({
context: "userLocker",
key: result.exportKey,
subkeyId: "1D4xb6ADE6j67ZttH7cj7Q",
});
setSessionKey(result.sessionKey);
setLockerKey(lockerKey.key);
<View className="bg-background flex-1">
<View className="max-w-md mr-auto ml-auto min-w-80 mt-32">
<AuthForm
onSubmit={async ({ password, username }) => {
const result = await registerAndLogin({
userIdentifier: username,
password,
});
if (!result) {
setError("Failed to register");
return;
}
const lockerKey = deriveKey({
context: "userLocker",
key: result.exportKey,
subkeyId: "1D4xb6ADE6j67ZttH7cj7Q",
});
setSessionKey(result.sessionKey);
setLockerKey(lockerKey.key);

if (redirect) {
router.navigate(redirect);
return;
}
router.navigate("/");
}}
children="Sign up"
isPending={isPending}
/>
{error && (
<View className="mt-4">
<View className="flex flex-row items-center gap-1">
<AlertCircle className="h-4 w-4" />
{/* TODO proper styling */}
<Text>Error</Text>
if (redirect) {
router.navigate(redirect);
return;
}
router.navigate("/");
}}
children="Sign up"
isPending={isPending}
/>
{error && (
<View className="mt-4">
<View className="flex flex-row items-center gap-1">
<AlertCircle className="h-4 w-4" />
{/* TODO proper styling */}
<Text>Error</Text>
</View>
<Text>Failed to sign up</Text>
</View>
<Text>Failed to sign up</Text>
</View>
)}
)}

<View className="mt-8 text-center">
<Link href="/login" className="text-center">
<Text>Login here</Text>
</Link>
<View className="mt-8 text-center">
<Link href="/login" className="text-center">
<Text>Login here</Text>
</Link>
</View>
</View>
</View>
);
Expand Down

0 comments on commit dc4f962

Please sign in to comment.