feat: add texts for no invites, no friends and no blocks

This commit is contained in:
Zamitto 2024-08-16 13:21:12 -03:00
parent d809317d62
commit f3276dd8fe
7 changed files with 35 additions and 21 deletions

View File

@ -268,6 +268,10 @@
"friends_only": "Friends only", "friends_only": "Friends only",
"privacy": "Privacy", "privacy": "Privacy",
"blocked_users": "Blocked users", "blocked_users": "Blocked users",
"unblock": "Unblock" "unblock": "Unblock",
"no_friends_added": "You still don't have added friends",
"pending": "Pending",
"no_pending_invites": "You have no pending invites",
"no_blocked_users": "You have no blocked users"
} }
} }

View File

@ -268,6 +268,10 @@
"friends_only": "Apenas amigos", "friends_only": "Apenas amigos",
"public": "Público", "public": "Público",
"blocked_users": "Usuários bloqueados", "blocked_users": "Usuários bloqueados",
"unblock": "Desbloquear" "unblock": "Desbloquear",
"no_friends_added": "Você ainda não possui amigos adicionados",
"pending": "Pendentes",
"no_pending_invites": "Você não possui convites de amizade pendentes",
"no_blocked_users": "Você não tem nenhum usuário bloqueado"
} }
} }

View File

@ -40,20 +40,16 @@ export const UserFriendModalAddFriend = ({
}); });
}; };
const resetAndClose = () => {
setFriendCode("");
closeModal();
};
const handleClickRequest = (userId: string) => { const handleClickRequest = (userId: string) => {
resetAndClose(); closeModal();
navigate(`/user/${userId}`); navigate(`/user/${userId}`);
}; };
const handleClickSeeProfile = () => { const handleClickSeeProfile = () => {
resetAndClose(); closeModal();
// TODO: add validation for this input? if (friendCode.length === 8) {
navigate(`/user/${friendCode}`); navigate(`/user/${friendCode}`);
}
}; };
const handleCancelFriendRequest = (userId: string) => { const handleCancelFriendRequest = (userId: string) => {
@ -122,7 +118,8 @@ export const UserFriendModalAddFriend = ({
gap: `${SPACING_UNIT * 2}px`, gap: `${SPACING_UNIT * 2}px`,
}} }}
> >
<h3>Pendentes</h3> <h3>{t("pending")}</h3>
{friendRequests.length === 0 && <p>{t("no_pending_invites")}</p>}
{friendRequests.map((request) => { {friendRequests.map((request) => {
return ( return (
<UserFriendItem <UserFriendItem

View File

@ -77,6 +77,7 @@ export const UserFriendModalList = ({
gap: `${SPACING_UNIT * 2}px`, gap: `${SPACING_UNIT * 2}px`,
}} }}
> >
{friends.length === 0 && <p>{t("no_friends_added")}</p>}
{friends.map((friend) => { {friends.map((friend) => {
return ( return (
<UserFriendItem <UserFriendItem

View File

@ -90,3 +90,15 @@ export const cancelRequestButton = style({
color: vars.color.danger, color: vars.color.danger,
}, },
}); });
export const friendCodeButton = style({
color: vars.color.body,
cursor: "pointer",
display: "flex",
gap: `${SPACING_UNIT / 2}px`,
alignItems: "center",
transition: "all ease 0.2s",
":hover": {
color: vars.color.muted,
},
});

View File

@ -1,11 +1,12 @@
import { Button, Modal } from "@renderer/components"; import { Button, Modal } from "@renderer/components";
import { SPACING_UNIT, vars } from "@renderer/theme.css"; import { SPACING_UNIT } from "@renderer/theme.css";
import { useCallback, useEffect, useState } from "react"; import { useCallback, useEffect, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { UserFriendModalAddFriend } from "./user-friend-modal-add-friend"; import { UserFriendModalAddFriend } from "./user-friend-modal-add-friend";
import { useToast, useUserDetails } from "@renderer/hooks"; import { useToast, useUserDetails } from "@renderer/hooks";
import { UserFriendModalList } from "./user-friend-modal-list"; import { UserFriendModalList } from "./user-friend-modal-list";
import { CopyIcon } from "@primer/octicons-react"; import { CopyIcon } from "@primer/octicons-react";
import * as styles from "./user-friend-modal.css";
export enum UserFriendModalTab { export enum UserFriendModalTab {
FriendsList, FriendsList,
@ -80,15 +81,9 @@ export const UserFriendModal = ({
alignItems: "center", alignItems: "center",
}} }}
> >
<p>Meu código de amigo: </p> <p>Seu código de amigo: </p>
<button <button
style={{ className={styles.friendCodeButton}
color: vars.color.body,
cursor: "pointer",
display: "flex",
gap: `${SPACING_UNIT / 2}px`,
alignItems: "center",
}}
onClick={copyToClipboard} onClick={copyToClipboard}
> >
<h3>{userDetails.id}</h3> <h3>{userDetails.id}</h3>

View File

@ -61,6 +61,7 @@ export const UserEditProfileBlockList = () => {
gap: `${SPACING_UNIT * 2}px`, gap: `${SPACING_UNIT * 2}px`,
}} }}
> >
{blocks.length === 0 && <p>{t("no_blocked_users")}</p>}
{blocks.map((friend) => { {blocks.map((friend) => {
return ( return (
<UserFriendItem <UserFriendItem