mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Display connected status on linked accounts
This commit is contained in:
parent
830a518b86
commit
d9022fde9f
@ -64,6 +64,19 @@ export const UserP = ResourceP("user")
|
|||||||
})
|
})
|
||||||
// keep a default for older versions of the api
|
// keep a default for older versions of the api
|
||||||
.default({}),
|
.default({}),
|
||||||
|
/**
|
||||||
|
* User accounts on other services.
|
||||||
|
*/
|
||||||
|
externalId: z
|
||||||
|
.record(
|
||||||
|
z.string(),
|
||||||
|
z.object({
|
||||||
|
id: z.string(),
|
||||||
|
username: z.string().optional(),
|
||||||
|
profileUrl: z.string().nullable(),
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.default({}),
|
||||||
})
|
})
|
||||||
.transform((x) => ({ ...x, logo: imageFn(`/user/${x.slug}/logo`) }));
|
.transform((x) => ({ ...x, logo: imageFn(`/user/${x.slug}/logo`) }));
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { QueryIdentifier, ServerInfo, ServerInfoP, useAccount, useFetch } from "@kyoo/models";
|
import { QueryIdentifier, ServerInfo, ServerInfoP, useAccount, useFetch } from "@kyoo/models";
|
||||||
import { IconButton, Skeleton, tooltip, ts } from "@kyoo/primitives";
|
import { A, Button, IconButton, Link, Skeleton, tooltip, ts } from "@kyoo/primitives";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { ImageBackground } from "react-native";
|
import { ImageBackground } from "react-native";
|
||||||
import { rem, useYoshiki } from "yoshiki/native";
|
import { rem, useYoshiki } from "yoshiki/native";
|
||||||
@ -41,37 +41,54 @@ export const OidcSettings = () => {
|
|||||||
{error ? (
|
{error ? (
|
||||||
<ErrorView error={error} />
|
<ErrorView error={error} />
|
||||||
) : data ? (
|
) : data ? (
|
||||||
Object.values(data.oidc).map((x) => (
|
Object.entries(data.oidc).map(([id, x]) => {
|
||||||
<Preference
|
const acc = account.externalId[id];
|
||||||
key={x.displayName}
|
return (
|
||||||
icon={Badge}
|
<Preference
|
||||||
label={x.displayName}
|
key={x.displayName}
|
||||||
description={
|
icon={Badge}
|
||||||
true
|
label={x.displayName}
|
||||||
? t("settings.oidc.connected", { username: "test" })
|
description={
|
||||||
: t("settings.oidc.not-connected")
|
acc
|
||||||
}
|
? t("settings.oidc.connected", { username: acc.username })
|
||||||
customIcon={
|
: t("settings.oidc.not-connected")
|
||||||
x.logoUrl != null && (
|
}
|
||||||
<ImageBackground
|
customIcon={
|
||||||
source={{ uri: x.logoUrl }}
|
x.logoUrl != null && (
|
||||||
{...css({ width: ts(3), height: ts(3), marginRight: ts(2) })}
|
<ImageBackground
|
||||||
|
source={{ uri: x.logoUrl }}
|
||||||
|
{...css({ width: ts(3), height: ts(3), marginRight: ts(2) })}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{acc ? (
|
||||||
|
<>
|
||||||
|
{acc.profileUrl && (
|
||||||
|
<IconButton
|
||||||
|
icon={OpenProfile}
|
||||||
|
as={Link}
|
||||||
|
href={acc.profileUrl}
|
||||||
|
target="_blank"
|
||||||
|
{...tooltip(t("settings.oidc.open-profile", { provider: x.displayName }))}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<IconButton
|
||||||
|
icon={Remove}
|
||||||
|
onPress={() => {}}
|
||||||
|
{...tooltip(t("settings.oidc.delete", { provider: x.displayName }))}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<Button
|
||||||
|
text={t("settings.oidc.link")}
|
||||||
|
onPress={() => {}}
|
||||||
|
{...css({ minWidth: rem(6) })}
|
||||||
/>
|
/>
|
||||||
)
|
)}
|
||||||
}
|
</Preference>
|
||||||
>
|
);
|
||||||
<IconButton
|
})
|
||||||
icon={OpenProfile}
|
|
||||||
onPress={() => {}}
|
|
||||||
{...tooltip(t("settings.oidc.open-profile", { provider: x.displayName }))}
|
|
||||||
/>
|
|
||||||
<IconButton
|
|
||||||
icon={Remove}
|
|
||||||
onPress={() => {}}
|
|
||||||
{...tooltip(t("settings.oidc.delete", { provider: x.displayName }))}
|
|
||||||
/>
|
|
||||||
</Preference>
|
|
||||||
))
|
|
||||||
) : (
|
) : (
|
||||||
[...Array(3)].map((_, i) => (
|
[...Array(3)].map((_, i) => (
|
||||||
<Preference
|
<Preference
|
||||||
|
@ -135,6 +135,7 @@
|
|||||||
"connected": "Connected as {{username}}.",
|
"connected": "Connected as {{username}}.",
|
||||||
"not-connected": "Disconnected",
|
"not-connected": "Disconnected",
|
||||||
"open-profile": "Open your {{provider}} profile",
|
"open-profile": "Open your {{provider}} profile",
|
||||||
|
"link": "Link",
|
||||||
"delete": "Unlink your kyoo's account with your {{provider}} account"
|
"delete": "Unlink your kyoo's account with your {{provider}} account"
|
||||||
},
|
},
|
||||||
"about": {
|
"about": {
|
||||||
|
@ -135,6 +135,7 @@
|
|||||||
"connected": "Connecté en tant que {{username}}.",
|
"connected": "Connecté en tant que {{username}}.",
|
||||||
"not-connected": "Déconnecté",
|
"not-connected": "Déconnecté",
|
||||||
"open-profile": "Ouvrir votre profil {{provider}}",
|
"open-profile": "Ouvrir votre profil {{provider}}",
|
||||||
|
"link": "Associer",
|
||||||
"delete": "Dissocier votre compte Kyoo de votre compte {{provider}}"
|
"delete": "Dissocier votre compte Kyoo de votre compte {{provider}}"
|
||||||
},
|
},
|
||||||
"about": {
|
"about": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user