From 304951e46341ffd4c7b8c11608f34ad276548a97 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sat, 28 Jan 2023 02:24:48 +0900 Subject: [PATCH] Create a simple login page --- front/packages/models/src/query.tsx | 13 ++-- front/packages/ui/src/login/index.tsx | 101 ++++++++++++++++++++++++- front/packages/ui/src/navbar/index.tsx | 4 +- front/translations/en.json | 7 ++ front/translations/fr.json | 7 ++ 5 files changed, 122 insertions(+), 10 deletions(-) diff --git a/front/packages/models/src/query.tsx b/front/packages/models/src/query.tsx index 92ddffe4..eec1a898 100644 --- a/front/packages/models/src/query.tsx +++ b/front/packages/models/src/query.tsx @@ -32,16 +32,17 @@ import { KyooErrors } from "./kyoo-errors"; import { Page, Paged } from "./page"; import { Platform } from "react-native"; +export const kyooUrl = + Platform.OS !== "web" + ? process.env.PUBLIC_BACK_URL + : typeof window === "undefined" + ? process.env.KYOO_URL ?? "http://localhost:5000" + : "/api"; + const queryFn = async ( type: z.ZodType, context: QueryFunctionContext, ): Promise => { - const kyooUrl = - Platform.OS !== "web" - ? process.env.PUBLIC_BACK_URL - : typeof window === "undefined" - ? process.env.KYOO_URL ?? "http://localhost:5000" - : "/api"; if (!kyooUrl) console.error("Kyoo's url is not defined."); let resp; diff --git a/front/packages/ui/src/login/index.tsx b/front/packages/ui/src/login/index.tsx index 7baca94d..af339421 100644 --- a/front/packages/ui/src/login/index.tsx +++ b/front/packages/ui/src/login/index.tsx @@ -19,11 +19,108 @@ */ import { QueryPage } from "@kyoo/models"; -import { View } from "react-native"; +import { Button, P, Input, ts, H1, A, IconButton } from "@kyoo/primitives"; +import { ComponentProps, useState } from "react"; +import { useTranslation } from "react-i18next"; +import { ImageBackground, ImageProps, Platform, View } from "react-native"; +import { Trans } from "react-i18next"; +import { max, min, percent, px, useYoshiki, vh, vw } from "yoshiki/native"; +import Visibility from "@material-symbols/svg-400/rounded/visibility-fill.svg"; +import VisibilityOff from "@material-symbols/svg-400/rounded/visibility_off-fill.svg"; import { DefaultLayout } from "../layout"; +const PasswordInput = (props: ComponentProps) => { + const { css } = useYoshiki(); + const [show, setVisibility] = useState(false); + console.log(show); + + return ( + setVisibility(!show)} + {...css({ width: px(19), height: px(19), m: 0, p: 0 })} + /> + } + {...props} + /> + ); +}; + export const LoginPage: QueryPage = () => { - return ; + const { t } = useTranslation(); + const { css } = useYoshiki(); + + // TODO: Replace the hardcoded 1 to a random show/movie thumbnail. + const src = `/api/shows/1/thumbnail`; + const nativeProps = Platform.select({ + web: { + defaultSource: typeof src === "string" ? { uri: src! } : Array.isArray(src) ? src[0] : src!, + }, + default: {}, + }); + + // TODO: Replace the borderRadius 99999 with an svg shape + + return ( + theme.dark.background, + })} + > + theme.background, + paddingHorizontal: ts(1), + borderRadius: 99999999999999999999999999999, + justifyContent: "flex-end", + alignItems: "flex-end", + })} + > + + +

{t("login.login")}

+

{t("login.email")}

+ +

{t("login.password")}

+ +