fix: adding translations for spanish

This commit is contained in:
Chubby Granny Chaser 2024-09-14 21:40:34 +01:00
parent 5432ef311a
commit aa8b685108
No known key found for this signature in database
12 changed files with 231 additions and 105 deletions

View file

@ -5,6 +5,7 @@ import { useTranslation } from "react-i18next";
import * as styles from "./profile-content.css";
import { Link } from "@renderer/components";
import { PersonIcon } from "@primer/octicons-react";
export function FriendsBox() {
const { userProfile, userStats } = useContext(userProfileContext);
@ -13,6 +14,8 @@ export function FriendsBox() {
const { numberFormatter } = useFormat();
if (!userProfile?.friends.length) return null;
return (
<div>
<div className={styles.sectionHeader}>
@ -27,11 +30,18 @@ export function FriendsBox() {
{userProfile?.friends.map((friend) => (
<li key={friend.id}>
<Link to={`/profile/${friend.id}`} className={styles.listItem}>
<img
src={friend.profileImageUrl!}
alt={friend.displayName}
className={styles.listItemImage}
/>
{friend.profileImageUrl ? (
<img
src={friend.profileImageUrl!}
alt={friend.displayName}
className={styles.listItemImage}
/>
) : (
<div className={styles.defaultAvatarWrapper}>
<PersonIcon size={16} />
</div>
)}
<span className={styles.friendName}>{friend.displayName}</span>
</Link>
</li>

View file

@ -176,3 +176,14 @@ export const listItemDescription = style({
alignItems: "center",
gap: `${SPACING_UNIT}px`,
});
export const defaultAvatarWrapper = style({
width: "32px",
height: "32px",
display: "flex",
justifyContent: "center",
alignItems: "center",
backgroundColor: vars.color.background,
border: `solid 1px ${vars.color.border}`,
borderRadius: "4px",
});

View file

@ -57,17 +57,9 @@ export function ProfileContent() {
return <LockedProfile />;
}
if (userProfile.libraryGames.length === 0) {
return (
<div className={styles.noGames}>
<div className={styles.telescopeIcon}>
<TelescopeIcon size={24} />
</div>
<h2>{t("no_recent_activity_title")}</h2>
{isMe && <p>{t("no_recent_activity_description")}</p>}
</div>
);
}
const hasGames = userProfile?.libraryGames.length > 0;
const shouldShowRightContent = hasGames || userProfile.friends.length > 0;
return (
<section
@ -78,57 +70,81 @@ export function ProfileContent() {
}}
>
<div style={{ flex: 1 }}>
<div className={styles.sectionHeader}>
<h2>{t("library")}</h2>
{!hasGames && (
<div className={styles.noGames}>
<div className={styles.telescopeIcon}>
<TelescopeIcon size={24} />
</div>
<h2>{t("no_recent_activity_title")}</h2>
{isMe && <p>{t("no_recent_activity_description")}</p>}
</div>
)}
{userStats && (
<span>{numberFormatter.format(userStats.libraryCount)}</span>
)}
</div>
{hasGames && (
<>
<div className={styles.sectionHeader}>
<h2>{t("library")}</h2>
<ul className={styles.gamesGrid}>
{userProfile?.libraryGames?.map((game) => (
<li
key={game.objectId}
style={{
borderRadius: 4,
overflow: "hidden",
position: "relative",
}}
className={styles.game}
>
<button
type="button"
style={{
cursor: "pointer",
}}
className={styles.gameCover}
onClick={() => navigate(buildUserGameDetailsPath(game))}
>
<img
src={steamUrlBuilder.cover(game.objectId)}
alt={game.title}
{userStats && (
<span>{numberFormatter.format(userStats.libraryCount)}</span>
)}
</div>
<ul className={styles.gamesGrid}>
{userProfile?.libraryGames?.map((game) => (
<li
key={game.objectId}
style={{
width: "100%",
objectFit: "cover",
borderRadius: 4,
overflow: "hidden",
position: "relative",
}}
/>
</button>
</li>
))}
</ul>
className={styles.game}
>
<button
type="button"
style={{
cursor: "pointer",
}}
className={styles.gameCover}
onClick={() => navigate(buildUserGameDetailsPath(game))}
>
<img
src={steamUrlBuilder.cover(game.objectId)}
alt={game.title}
style={{
width: "100%",
objectFit: "cover",
borderRadius: 4,
}}
/>
</button>
</li>
))}
</ul>
</>
)}
</div>
<div className={styles.rightContent}>
<RecentGamesBox />
<FriendsBox />
{shouldShowRightContent && (
<div className={styles.rightContent}>
<RecentGamesBox />
<FriendsBox />
<ReportProfile />
</div>
<ReportProfile />
</div>
)}
</section>
);
}, [userProfile, isMe, usersAreFriends, numberFormatter, t, navigate]);
}, [
userProfile,
isMe,
usersAreFriends,
userStats,
numberFormatter,
t,
navigate,
]);
return (
<div>

View file

@ -72,7 +72,7 @@ export function ReportProfile() {
<Modal
visible={showReportProfileModal}
onClose={() => setShowReportProfileModal(false)}
title="Report this profile"
title={t("report_profile")}
clickOutsideToClose={false}
>
<form
@ -96,7 +96,6 @@ export function ReportProfile() {
value: reason,
label: t(`report_reason_${reason}`),
}))}
disabled={isSubmitting}
/>
);
}}
@ -122,6 +121,7 @@ export function ReportProfile() {
type="button"
className={styles.reportButton}
onClick={() => setShowReportProfileModal(true)}
disabled={isSubmitting}
>
<ReportIcon size={13} />
{t("report_profile")}

View file

@ -57,16 +57,13 @@ export function SettingsPrivacy() {
unblockUser(id)
.then(() => {
fetchBlockedUsers();
// show toast
})
.catch(() => {
//show toast
showSuccessToast(t("user_unblocked"));
})
.finally(() => {
setIsUnblocking(false);
});
},
[unblockUser, fetchBlockedUsers]
[unblockUser, fetchBlockedUsers, t, showSuccessToast]
);
return (