Compare commits

..

3 Commits

Author SHA1 Message Date
Zamitto
194e7918ca feat: dont setup ww feedback widget if user has no token
Some checks failed
Build Renderer / build (push) Has been cancelled
Release / build (ubuntu-latest) (push) Has been cancelled
Release / build (windows-2022) (push) Has been cancelled
2026-01-15 08:42:33 -03:00
Zamitto
96140e614c Merge pull request #1917 from hydralauncher/fix/friends-box-display
Some checks failed
Build Renderer / build (push) Has been cancelled
Release / build (ubuntu-latest) (push) Has been cancelled
Release / build (windows-2022) (push) Has been cancelled
hotfix: add empty state for friends box and new translation key
2026-01-04 02:59:53 -03:00
Moyasee
2ccc93ea61 feat: add empty state for friends box and new translation key 2026-01-04 04:23:59 +02:00
7 changed files with 34 additions and 7 deletions

View File

@@ -689,6 +689,7 @@
"blocked_users": "Blocked users", "blocked_users": "Blocked users",
"unblock": "Unblock", "unblock": "Unblock",
"no_friends_added": "You have no added friends", "no_friends_added": "You have no added friends",
"no_friends_yet": "You haven't added any friends yet",
"view_all": "View all", "view_all": "View all",
"load_more": "Load more", "load_more": "Load more",
"loading": "Loading", "loading": "Loading",

View File

@@ -508,7 +508,7 @@
"show_and_compare_achievements": "Mostra e compara as tuas conquistas com as de outros utilizadores", "show_and_compare_achievements": "Mostra e compara as tuas conquistas com as de outros utilizadores",
"animated_profile_banner": "Banner animado no perfil", "animated_profile_banner": "Banner animado no perfil",
"cloud_saving": "Progresso dos jogos na nuvem", "cloud_saving": "Progresso dos jogos na nuvem",
"hydra_cloud_feature_found": "Descobriste uma funcionalidade Hydra Cloud!", "hydra_cloud_feature_found": "Descubriste uma funcionalidade Hydra Cloud!",
"learn_more": "Saber mais" "learn_more": "Saber mais"
} }
} }

View File

@@ -46,7 +46,7 @@ export class SevenZip {
onProgress?: (progress: ExtractionProgress) => void onProgress?: (progress: ExtractionProgress) => void
): Promise<ExtractionResult> { ): Promise<ExtractionResult> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const tryPassword = (index = 0) => { const tryPassword = (index = -1) => {
const password = passwords[index] ?? ""; const password = passwords[index] ?? "";
logger.info( logger.info(
`Trying password "${password || "(empty)"}" on ${filePath}` `Trying password "${password || "(empty)"}" on ${filePath}`
@@ -115,7 +115,7 @@ export class SevenZip {
}); });
}; };
tryPassword(0); tryPassword();
}); });
} }

View File

@@ -134,7 +134,10 @@ export function App() {
await workwondersRef.current.initChangelogWidget(); await workwondersRef.current.initChangelogWidget();
workwondersRef.current.initChangelogWidgetMini(); workwondersRef.current.initChangelogWidgetMini();
workwondersRef.current.initFeedbackWidget();
if (token) {
workwondersRef.current.initFeedbackWidget();
}
}, },
[workwondersRef] [workwondersRef]
); );

View File

@@ -4,6 +4,20 @@
&__box { &__box {
padding: calc(globals.$spacing-unit * 2); padding: calc(globals.$spacing-unit * 2);
position: relative; position: relative;
&--empty {
display: flex;
flex-direction: column;
align-items: center;
gap: calc(globals.$spacing-unit * 2);
}
}
&__empty-text {
color: globals.$muted-color;
font-size: globals.$small-font-size;
margin: 0;
text-align: center;
} }
&__add-friend-button { &__add-friend-button {

View File

@@ -19,6 +19,7 @@ export function FriendsBox() {
const [showAddFriendModal, setShowAddFriendModal] = useState(false); const [showAddFriendModal, setShowAddFriendModal] = useState(false);
const isMe = userDetails?.id === userProfile?.id; const isMe = userDetails?.id === userProfile?.id;
const hasFriends = userProfile?.friends && userProfile.friends.length > 0;
const getGameImage = (game: { iconUrl: string | null; title: string }) => { const getGameImage = (game: { iconUrl: string | null; title: string }) => {
if (game.iconUrl) { if (game.iconUrl) {
@@ -35,7 +36,15 @@ export function FriendsBox() {
return <SteamLogo width={16} height={16} />; return <SteamLogo width={16} height={16} />;
}; };
if (!userProfile?.friends.length) return null; if (!hasFriends) {
if (!isMe) return null;
return (
<div className="friends-box__box friends-box__box--empty">
<p className="friends-box__empty-text">{t("no_friends_yet")}</p>
</div>
);
}
const visibleFriends = userProfile.friends.slice(0, MAX_VISIBLE_FRIENDS); const visibleFriends = userProfile.friends.slice(0, MAX_VISIBLE_FRIENDS);
const totalFriends = userProfile.friends.length; const totalFriends = userProfile.friends.length;

View File

@@ -376,7 +376,7 @@ export function ProfileContent() {
const hasAnyGames = hasGames || hasPinnedGames; const hasAnyGames = hasGames || hasPinnedGames;
const shouldShowRightContent = const shouldShowRightContent =
hasAnyGames || userProfile.friends.length > 0; hasAnyGames || userProfile.friends.length > 0 || isMe;
return ( return (
<section className="profile-content__section"> <section className="profile-content__section">
@@ -444,7 +444,7 @@ export function ProfileContent() {
<RecentGamesBox /> <RecentGamesBox />
</ProfileSection> </ProfileSection>
)} )}
{userProfile?.friends.length > 0 && ( {(userProfile?.friends.length > 0 || isMe) && (
<ProfileSection <ProfileSection
title={t("friends")} title={t("friends")}
count={userStats?.friendsCount || userProfile.friends.length} count={userStats?.friendsCount || userProfile.friends.length}