mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-11 05:46:17 +00:00
Merge branch 'feat/LBX-155' of https://github.com/hydralauncher/hydra into feat/LBX-155
This commit is contained in:
@@ -730,7 +730,10 @@
|
||||
"karma_description": "Earned from positive likes on reviews",
|
||||
"user_reviews": "Reviews",
|
||||
"delete_review": "Delete Review",
|
||||
"loading_reviews": "Loading reviews..."
|
||||
"loading_reviews": "Loading reviews...",
|
||||
"wrapped_2025": "Wrapped 2025",
|
||||
"view_my_wrapped_button": "View My Wrapped 2025",
|
||||
"view_wrapped_button": "View {{displayName}}'s Wrapped 2025"
|
||||
},
|
||||
"library": {
|
||||
"library": "Library",
|
||||
|
||||
@@ -36,9 +36,9 @@ export class WindowManager {
|
||||
private static initialConfigInitializationMainWindow: Electron.BrowserWindowConstructorOptions =
|
||||
{
|
||||
width: 1200,
|
||||
height: 720,
|
||||
height: 860,
|
||||
minWidth: 1024,
|
||||
minHeight: 540,
|
||||
minHeight: 860,
|
||||
backgroundColor: "#1c1c1c",
|
||||
titleBarStyle: process.platform === "linux" ? "default" : "hidden",
|
||||
icon,
|
||||
@@ -106,7 +106,7 @@ export class WindowManager {
|
||||
valueEncoding: "json",
|
||||
}
|
||||
);
|
||||
return data ?? { isMaximized: false, height: 720, width: 1200 };
|
||||
return data ?? { isMaximized: false, height: 860, width: 1200 };
|
||||
}
|
||||
|
||||
private static updateInitialConfig(
|
||||
@@ -224,7 +224,7 @@ export class WindowManager {
|
||||
? {
|
||||
x: undefined,
|
||||
y: undefined,
|
||||
height: this.initialConfigInitializationMainWindow.height ?? 720,
|
||||
height: this.initialConfigInitializationMainWindow.height ?? 860,
|
||||
width: this.initialConfigInitializationMainWindow.width ?? 1200,
|
||||
isMaximized: true,
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import { ProfileSection } from "../profile-section/profile-section";
|
||||
import { DeleteReviewModal } from "@renderer/pages/game-details/modals/delete-review-modal";
|
||||
import { GAME_STATS_ANIMATION_DURATION_IN_MS } from "./profile-animations";
|
||||
import { MAX_MINUTES_TO_SHOW_IN_PLAYTIME } from "@renderer/constants";
|
||||
import { ProfileTabs } from "./profile-tabs";
|
||||
import { ProfileTabs, type ProfileTabType } from "./profile-tabs";
|
||||
import { LibraryTab } from "./library-tab";
|
||||
import { ReviewsTab } from "./reviews-tab";
|
||||
import { AnimatePresence } from "framer-motion";
|
||||
@@ -96,7 +96,7 @@ export function ProfileContent() {
|
||||
const [sortBy, setSortBy] = useState<SortOption>("playedRecently");
|
||||
const statsAnimation = useRef(-1);
|
||||
|
||||
const [activeTab, setActiveTab] = useState<"library" | "reviews">("library");
|
||||
const [activeTab, setActiveTab] = useState<ProfileTabType>("library");
|
||||
|
||||
// User reviews state
|
||||
const [reviews, setReviews] = useState<UserReview[]>([]);
|
||||
|
||||
@@ -2,10 +2,12 @@ import { motion } from "framer-motion";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import "./profile-content.scss";
|
||||
|
||||
export type ProfileTabType = "library" | "reviews";
|
||||
|
||||
interface ProfileTabsProps {
|
||||
activeTab: "library" | "reviews";
|
||||
activeTab: ProfileTabType;
|
||||
reviewsTotalCount: number;
|
||||
onTabChange: (tab: "library" | "reviews") => void;
|
||||
onTabChange: (tab: ProfileTabType) => void;
|
||||
}
|
||||
|
||||
export function ProfileTabs({
|
||||
|
||||
100
src/renderer/src/pages/profile/profile-content/wrapped-tab.scss
Normal file
100
src/renderer/src/pages/profile/profile-content/wrapped-tab.scss
Normal file
@@ -0,0 +1,100 @@
|
||||
@use "../../../scss/globals.scss";
|
||||
|
||||
.wrapped-fullscreen-modal {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 999;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: none;
|
||||
background: transparent;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
&__backdrop {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: rgba(0, 0, 0, 0.9);
|
||||
border: none;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
&__container {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: calc(globals.$spacing-unit * 2);
|
||||
pointer-events: none;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
&__close-button {
|
||||
position: absolute;
|
||||
top: calc(globals.$spacing-unit * 5);
|
||||
right: calc(globals.$spacing-unit * 5);
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
color: white;
|
||||
transition: background 0.2s ease;
|
||||
z-index: 10;
|
||||
pointer-events: auto;
|
||||
|
||||
&:hover {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
}
|
||||
|
||||
&__content {
|
||||
position: relative;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
box-shadow: 0 8px 48px rgba(0, 0, 0, 0.5);
|
||||
pointer-events: auto;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
&__loader {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
&__spinner {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border: 3px solid rgba(255, 255, 255, 0.2);
|
||||
border-top-color: white;
|
||||
border-radius: 50%;
|
||||
animation: wrapped-spin 0.8s linear infinite;
|
||||
}
|
||||
|
||||
&__iframe {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes wrapped-spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { XIcon } from "@primer/octicons-react";
|
||||
import "./wrapped-tab.scss";
|
||||
|
||||
interface WrappedFullscreenModalProps {
|
||||
userId: string;
|
||||
isOpen: boolean;
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
interface ScaleConfig {
|
||||
scale: number;
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
const SCALE_CONFIGS: Record<number, ScaleConfig> = {
|
||||
0.25: { scale: 0.25, width: 270, height: 480 },
|
||||
0.3: { scale: 0.3, width: 324, height: 576 },
|
||||
0.5: { scale: 0.5, width: 540, height: 960 },
|
||||
};
|
||||
|
||||
const getScaleConfigForHeight = (height: number): ScaleConfig => {
|
||||
if (height >= 1000) return SCALE_CONFIGS[0.5];
|
||||
if (height >= 650) return SCALE_CONFIGS[0.3];
|
||||
return SCALE_CONFIGS[0.25];
|
||||
};
|
||||
|
||||
export function WrappedFullscreenModal({
|
||||
userId,
|
||||
isOpen,
|
||||
onClose,
|
||||
}: Readonly<WrappedFullscreenModalProps>) {
|
||||
const [config, setConfig] = useState<ScaleConfig>(SCALE_CONFIGS[0.5]);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isOpen) return;
|
||||
|
||||
const updateConfig = () => {
|
||||
setConfig(getScaleConfigForHeight(window.innerHeight));
|
||||
};
|
||||
|
||||
updateConfig();
|
||||
window.addEventListener("resize", updateConfig);
|
||||
return () => window.removeEventListener("resize", updateConfig);
|
||||
}, [isOpen]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isOpen) {
|
||||
setIsLoading(true);
|
||||
}
|
||||
}, [isOpen]);
|
||||
|
||||
if (!isOpen) return null;
|
||||
|
||||
return (
|
||||
<dialog className="wrapped-fullscreen-modal" aria-modal="true" open>
|
||||
<button
|
||||
type="button"
|
||||
className="wrapped-fullscreen-modal__backdrop"
|
||||
onClick={onClose}
|
||||
aria-label="Close wrapped"
|
||||
/>
|
||||
<div className="wrapped-fullscreen-modal__container">
|
||||
<button
|
||||
type="button"
|
||||
className="wrapped-fullscreen-modal__close-button"
|
||||
onClick={onClose}
|
||||
aria-label="Close wrapped"
|
||||
>
|
||||
<XIcon size={24} />
|
||||
</button>
|
||||
|
||||
<div
|
||||
className="wrapped-fullscreen-modal__content"
|
||||
style={{ width: config.width, height: config.height }}
|
||||
>
|
||||
{isLoading && (
|
||||
<div className="wrapped-fullscreen-modal__loader">
|
||||
<div className="wrapped-fullscreen-modal__spinner" />
|
||||
</div>
|
||||
)}
|
||||
<iframe
|
||||
src={`https://hydrawrapped.com/embed/${userId}?scale=${config.scale}`}
|
||||
className="wrapped-fullscreen-modal__iframe"
|
||||
title="Wrapped 2025"
|
||||
onLoad={() => setIsLoading(false)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</dialog>
|
||||
);
|
||||
}
|
||||
@@ -144,6 +144,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
&__left-actions {
|
||||
display: flex;
|
||||
gap: globals.$spacing-unit;
|
||||
}
|
||||
|
||||
&__actions {
|
||||
display: flex;
|
||||
gap: globals.$spacing-unit;
|
||||
@@ -155,5 +160,35 @@
|
||||
&--outline {
|
||||
border-color: globals.$body-color;
|
||||
}
|
||||
|
||||
&--wrapped {
|
||||
background: linear-gradient(
|
||||
120deg,
|
||||
#2a57ff 0%,
|
||||
#2951e6 11%,
|
||||
#2f5bff 16%,
|
||||
#2c56e8 29%,
|
||||
#244acc 34%,
|
||||
#2245c2 40%,
|
||||
#3a6bff 45%,
|
||||
#3766f2 50%,
|
||||
#2444b8 56%,
|
||||
#122a73 82%,
|
||||
#2348b3 86%,
|
||||
#1f429e 87%,
|
||||
#10286a 93%,
|
||||
#0e2a63 100%
|
||||
);
|
||||
background-color: #2a57ff;
|
||||
background-size: 105% 100%;
|
||||
background-position: 100% 50%;
|
||||
border: none;
|
||||
color: white;
|
||||
transition: background-position 0.4s ease;
|
||||
|
||||
&:hover {
|
||||
background-position: 0% 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
PencilIcon,
|
||||
PersonAddIcon,
|
||||
SignOutIcon,
|
||||
TrophyIcon,
|
||||
XCircleFillIcon,
|
||||
} from "@primer/octicons-react";
|
||||
import { buildGameDetailsPath } from "@renderer/helpers";
|
||||
@@ -29,6 +30,7 @@ import { motion } from "framer-motion";
|
||||
|
||||
import type { FriendRequestAction } from "@types";
|
||||
import { EditProfileModal } from "../edit-profile-modal/edit-profile-modal";
|
||||
import { WrappedFullscreenModal } from "../profile-content/wrapped-tab";
|
||||
import Skeleton from "react-loading-skeleton";
|
||||
import { UploadBackgroundImageButton } from "../upload-background-image-button/upload-background-image-button";
|
||||
import "./profile-hero.scss";
|
||||
@@ -39,6 +41,7 @@ type FriendAction =
|
||||
|
||||
export function ProfileHero() {
|
||||
const [showEditProfileModal, setShowEditProfileModal] = useState(false);
|
||||
const [showWrappedModal, setShowWrappedModal] = useState(false);
|
||||
const [showFullscreenAvatar, setShowFullscreenAvatar] = useState(false);
|
||||
const [isPerformingAction, setIsPerformingAction] = useState(false);
|
||||
const [isCopyButtonHovered, setIsCopyButtonHovered] = useState(false);
|
||||
@@ -283,6 +286,13 @@ export function ProfileHero() {
|
||||
onClose={() => setShowEditProfileModal(false)}
|
||||
/>
|
||||
|
||||
{userProfile && (
|
||||
<WrappedFullscreenModal
|
||||
userId={userProfile.id}
|
||||
isOpen={showWrappedModal}
|
||||
onClose={() => setShowWrappedModal(false)}
|
||||
/>
|
||||
)}
|
||||
<FullscreenMediaModal
|
||||
visible={showFullscreenAvatar}
|
||||
onClose={() => setShowFullscreenAvatar(false)}
|
||||
@@ -400,6 +410,22 @@ export function ProfileHero() {
|
||||
background: !backgroundImage ? heroBackground : undefined,
|
||||
}}
|
||||
>
|
||||
{userProfile?.hasCompletedWrapped2025 && (
|
||||
<div className="profile-hero__left-actions">
|
||||
<Button
|
||||
theme="outline"
|
||||
onClick={() => setShowWrappedModal(true)}
|
||||
className="profile-hero__button--wrapped"
|
||||
>
|
||||
<TrophyIcon />
|
||||
{isMe
|
||||
? t("view_my_wrapped_button")
|
||||
: t("view_wrapped_button", {
|
||||
displayName: userProfile.displayName,
|
||||
})}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
<div className="profile-hero__actions">{profileActions}</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -214,6 +214,7 @@ export interface UserProfile {
|
||||
backupsPerGameLimit: number;
|
||||
};
|
||||
badges: string[];
|
||||
hasCompletedWrapped2025: boolean;
|
||||
}
|
||||
|
||||
export interface UpdateProfileRequest {
|
||||
|
||||
Reference in New Issue
Block a user