mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
fix: adding translations for spanish
This commit is contained in:
parent
5432ef311a
commit
aa8b685108
12 changed files with 231 additions and 105 deletions
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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")}
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue