Simplify login screen
- Only warn about the minimum instance version if there may be a compatibility issue - Remove username placeholder because it's not communicating new information - Remove subtitle to improve signal-to-noise ratio
This commit is contained in:
1 parent
b18aedfc45
commit
15aaa33374
2 files changed
+35
-11
No files matched your search
@@ -99,3 +99,28 @@ export async function validateInstance(instance: string): Promise<boolean> {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
export function mayBeIncompatible(minVersion: string, availableVersion: string) {
|
||||
if (minVersion.valueOf() === availableVersion.valueOf()) return false;
|
||||
|
||||
const versionFormatter = /[\d.]/;
|
||||
if (!minVersion.match(versionFormatter) || !availableVersion.match(availableVersion)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const splitMinVersion = minVersion.split('.');
|
||||
const splitAvailableVersion = availableVersion.split('.');
|
||||
|
||||
if (splitMinVersion.length !== splitAvailableVersion.length) return true;
|
||||
|
||||
for (let i = 0; i < splitMinVersion.length; ++i) {
|
||||
const minVersionDigit = parseInt(splitMinVersion[i]);
|
||||
const availableVersionDigit = parseInt(splitAvailableVersion[i]);
|
||||
|
||||
if (availableVersionDigit === undefined) return true;
|
||||
if (minVersionDigit < availableVersionDigit) return false;
|
||||
if (availableVersionDigit < minVersionDigit) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -3,10 +3,9 @@
|
||||
import { setUser } from '$lib/auth.js'
|
||||
import { Note, toast } from 'mono-svelte'
|
||||
import { DEFAULT_INSTANCE_URL, LINKED_INSTANCE_URL } from '$lib/instance.js'
|
||||
import { getClient, validateInstance } from '$lib/lemmy.js'
|
||||
import { getClient, mayBeIncompatible, site, validateInstance } from '$lib/lemmy.js'
|
||||
import { Button, TextInput } from 'mono-svelte'
|
||||
import {
|
||||
AtSymbol,
|
||||
Icon,
|
||||
Identification,
|
||||
QuestionMarkCircle,
|
||||
@@ -65,21 +64,21 @@
|
||||
<form on:submit|preventDefault={logIn} class="flex flex-col gap-5">
|
||||
<div class="flex flex-col gap-2">
|
||||
<h1 class="font-bold text-3xl">Log In</h1>
|
||||
<p>Enter the fediverse</p>
|
||||
<Note>
|
||||
This version of Photon supports instances running
|
||||
<span style="font-family: monospace;">
|
||||
v{MINIMUM_VERSION}
|
||||
</span>
|
||||
or higher.
|
||||
</Note>
|
||||
{#if $site && mayBeIncompatible(MINIMUM_VERSION, $site.version.replace("v", ""))}
|
||||
<Note>
|
||||
This version of Photon supports instances running
|
||||
<span style="font-family: monospace;">
|
||||
v{MINIMUM_VERSION}
|
||||
</span>
|
||||
or higher.
|
||||
</Note>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="flex flex-row w-full items-center gap-2">
|
||||
<TextInput
|
||||
id="username"
|
||||
bind:value={data.username}
|
||||
label="Username"
|
||||
placeholder="Example"
|
||||
class="flex-1"
|
||||
required
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user