mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Fix account button size
This commit is contained in:
parent
3e140e4f43
commit
e185625f4a
@ -18,7 +18,7 @@
|
|||||||
* along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
* along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { View } from "react-native";
|
import { TextStyle, View } from "react-native";
|
||||||
import { Image } from "./image";
|
import { Image } from "./image";
|
||||||
import { useYoshiki, px, Stylable } from "yoshiki/native";
|
import { useYoshiki, px, Stylable } from "yoshiki/native";
|
||||||
import { Icon } from "./icons";
|
import { Icon } from "./icons";
|
||||||
@ -26,6 +26,7 @@ import AccountCircle from "@material-symbols/svg-400/rounded/account_circle-fill
|
|||||||
import { YoshikiStyle } from "yoshiki/dist/type";
|
import { YoshikiStyle } from "yoshiki/dist/type";
|
||||||
import { P } from "@expo/html-elements";
|
import { P } from "@expo/html-elements";
|
||||||
import { forwardRef } from "react";
|
import { forwardRef } from "react";
|
||||||
|
import { ts } from "./utils";
|
||||||
|
|
||||||
const stringToColor = (string: string) => {
|
const stringToColor = (string: string) => {
|
||||||
let hash = 0;
|
let hash = 0;
|
||||||
@ -41,7 +42,7 @@ const stringToColor = (string: string) => {
|
|||||||
color += `00${value.toString(16)}`.slice(-2);
|
color += `00${value.toString(16)}`.slice(-2);
|
||||||
}
|
}
|
||||||
return color;
|
return color;
|
||||||
}
|
};
|
||||||
|
|
||||||
export const Avatar = forwardRef<
|
export const Avatar = forwardRef<
|
||||||
View,
|
View,
|
||||||
@ -67,7 +68,11 @@ export const Avatar = forwardRef<
|
|||||||
ref={ref}
|
ref={ref}
|
||||||
{...css(
|
{...css(
|
||||||
[
|
[
|
||||||
{ borderRadius: 999999, width: size, height: size, overflow: "hidden" },
|
{
|
||||||
|
borderRadius: 999999,
|
||||||
|
overflow: "hidden",
|
||||||
|
p: ts(1),
|
||||||
|
},
|
||||||
fill && {
|
fill && {
|
||||||
bg: col,
|
bg: col,
|
||||||
},
|
},
|
||||||
@ -75,8 +80,6 @@ export const Avatar = forwardRef<
|
|||||||
!src &&
|
!src &&
|
||||||
!isLoading && {
|
!isLoading && {
|
||||||
bg: stringToColor(placeholder),
|
bg: stringToColor(placeholder),
|
||||||
justifyContent: "center",
|
|
||||||
alignItems: "center",
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
props,
|
props,
|
||||||
@ -85,7 +88,17 @@ export const Avatar = forwardRef<
|
|||||||
{src || isLoading ? (
|
{src || isLoading ? (
|
||||||
<Image src={src} alt={alt} layout={{ width: size, height: size }} />
|
<Image src={src} alt={alt} layout={{ width: size, height: size }} />
|
||||||
) : placeholder ? (
|
) : placeholder ? (
|
||||||
<P {...css({})}>{placeholder[0]}</P>
|
<P
|
||||||
|
{...css({
|
||||||
|
marginVertical: 0,
|
||||||
|
height: size,
|
||||||
|
width: size,
|
||||||
|
lineHeight: size,
|
||||||
|
textAlign: "center",
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
{placeholder[0]}
|
||||||
|
</P>
|
||||||
) : (
|
) : (
|
||||||
<Icon icon={AccountCircle} size={size} color={fill ? col : theme.colors.white} />
|
<Icon icon={AccountCircle} size={size} color={fill ? col : theme.colors.white} />
|
||||||
)}
|
)}
|
||||||
|
@ -43,7 +43,7 @@ export const FormPage = ({ children, ...props }: { children: ReactNode } & Styla
|
|||||||
const { css } = useYoshiki();
|
const { css } = useYoshiki();
|
||||||
|
|
||||||
// TODO: Replace the hardcoded 1 to a random show/movie thumbnail.
|
// TODO: Replace the hardcoded 1 to a random show/movie thumbnail.
|
||||||
const src = `${Platform.OS === "web" ? "/api/" : process.env.PUBLIC_BACK_URL}/shows/1/thumbnail`;
|
const src = `${Platform.OS === "web" ? "/api" : process.env.PUBLIC_BACK_URL}/shows/1/thumbnail`;
|
||||||
const nativeProps = Platform.select<Partial<ImageProps>>({
|
const nativeProps = Platform.select<Partial<ImageProps>>({
|
||||||
web: {
|
web: {
|
||||||
defaultSource: typeof src === "string" ? { uri: src! } : Array.isArray(src) ? src[0] : src!,
|
defaultSource: typeof src === "string" ? { uri: src! } : Array.isArray(src) ? src[0] : src!,
|
||||||
|
@ -32,6 +32,7 @@ import { PasswordInput } from "./password-input";
|
|||||||
import { useQueryClient } from "@tanstack/react-query";
|
import { useQueryClient } from "@tanstack/react-query";
|
||||||
|
|
||||||
export const cleanApiUrl = (apiUrl: string) => {
|
export const cleanApiUrl = (apiUrl: string) => {
|
||||||
|
if (Platform.OS === "web") return undefined;
|
||||||
if (!/https?:\/\//.test(apiUrl)) apiUrl = "http://" + apiUrl;
|
if (!/https?:\/\//.test(apiUrl)) apiUrl = "http://" + apiUrl;
|
||||||
apiUrl = apiUrl.replace(/\/$/, "");
|
apiUrl = apiUrl.replace(/\/$/, "");
|
||||||
return apiUrl + "/api";
|
return apiUrl + "/api";
|
||||||
|
@ -34,7 +34,7 @@ import { Platform, TextInput, View, ViewProps } from "react-native";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { createParam } from "solito";
|
import { createParam } from "solito";
|
||||||
import { useRouter } from "solito/router";
|
import { useRouter } from "solito/router";
|
||||||
import { rem, Stylable, useYoshiki } from "yoshiki/native";
|
import { px, rem, Stylable, useYoshiki } from "yoshiki/native";
|
||||||
import MenuIcon from "@material-symbols/svg-400/rounded/menu-fill.svg";
|
import MenuIcon from "@material-symbols/svg-400/rounded/menu-fill.svg";
|
||||||
import Search from "@material-symbols/svg-400/rounded/search-fill.svg";
|
import Search from "@material-symbols/svg-400/rounded/search-fill.svg";
|
||||||
import { Fetch, FetchNE } from "../fetch";
|
import { Fetch, FetchNE } from "../fetch";
|
||||||
@ -78,7 +78,7 @@ const SearchBar = forwardRef<
|
|||||||
placeholder={t("navbar.search")}
|
placeholder={t("navbar.search")}
|
||||||
placeholderTextColor={theme.light.overlay0}
|
placeholderTextColor={theme.light.overlay0}
|
||||||
{...tooltip(t("navbar.search"))}
|
{...tooltip(t("navbar.search"))}
|
||||||
{...css({ borderColor: (theme) => theme.colors.white }, props)}
|
{...css({ borderColor: (theme) => theme.colors.white, height: ts(4) }, props)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -100,9 +100,9 @@ export const NavbarProfile = () => {
|
|||||||
Trigger={Avatar}
|
Trigger={Avatar}
|
||||||
placeholder={username}
|
placeholder={username}
|
||||||
alt={t("navbar.login")}
|
alt={t("navbar.login")}
|
||||||
size={30}
|
size={24}
|
||||||
color={theme.colors.white}
|
color={theme.colors.white}
|
||||||
{...css({ marginLeft: ts(1), marginVertical: "auto", justifyContent: "center" })}
|
{...css({ marginLeft: ts(1), justifyContent: "center" })}
|
||||||
{...tooltip(username ?? t("navbar.login"))}
|
{...tooltip(username ?? t("navbar.login"))}
|
||||||
>
|
>
|
||||||
{isGuest ? (
|
{isGuest ? (
|
||||||
@ -136,7 +136,7 @@ export const NavbarRight = () => {
|
|||||||
const searchExpanded = isSearching || query;
|
const searchExpanded = isSearching || query;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View {...css({ flexDirection: "row" })}>
|
<View {...css({ flexDirection: "row", alignItems: "center" })}>
|
||||||
{Platform.OS === "web" && (
|
{Platform.OS === "web" && (
|
||||||
<SearchBar
|
<SearchBar
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user