mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-02 16:23:48 +03:00
Merge pull request #981 from hydralauncher/feature/adding-flame-animation
feat: adding flame animation
This commit is contained in:
commit
ef16732c0a
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydralauncher",
|
"name": "hydralauncher",
|
||||||
"version": "2.1.3",
|
"version": "2.1.4",
|
||||||
"description": "Hydra",
|
"description": "Hydra",
|
||||||
"main": "./out/main/index.js",
|
"main": "./out/main/index.js",
|
||||||
"author": "Los Broxas",
|
"author": "Los Broxas",
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
"surprise_me": "Surprise me",
|
"surprise_me": "Surprise me",
|
||||||
"no_results": "No results found",
|
"no_results": "No results found",
|
||||||
"start_typing": "Starting typing to search...",
|
"start_typing": "Starting typing to search...",
|
||||||
"hot": "🔥 Hot now",
|
"hot": "Hot now",
|
||||||
"weekly": "📅 Top games of the week"
|
"weekly": "📅 Top games of the week"
|
||||||
},
|
},
|
||||||
"sidebar": {
|
"sidebar": {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
"trending": "Tendencias",
|
"trending": "Tendencias",
|
||||||
"surprise_me": "¡Sorpréndeme!",
|
"surprise_me": "¡Sorpréndeme!",
|
||||||
"no_results": "No se encontraron resultados",
|
"no_results": "No se encontraron resultados",
|
||||||
"hot": "🔥 Caliente ahora",
|
"hot": "Caliente ahora",
|
||||||
"weekly": "📅 Los mejores juegos de la semana",
|
"weekly": "📅 Los mejores juegos de la semana",
|
||||||
"start_typing": "Empieza a escribir para buscar..."
|
"start_typing": "Empieza a escribir para buscar..."
|
||||||
},
|
},
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"home": {
|
"home": {
|
||||||
"featured": "Destaques",
|
"featured": "Destaques",
|
||||||
"trending": "Populares",
|
"trending": "Populares",
|
||||||
"hot": "🔥 Populares agora",
|
"hot": "Populares agora",
|
||||||
"weekly": "📅 Mais baixados da semana",
|
"weekly": "📅 Mais baixados da semana",
|
||||||
"surprise_me": "Surpreenda-me",
|
"surprise_me": "Surpreenda-me",
|
||||||
"no_results": "Nenhum resultado encontrado",
|
"no_results": "Nenhum resultado encontrado",
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
"trending": "В тренде",
|
"trending": "В тренде",
|
||||||
"surprise_me": "Удиви меня",
|
"surprise_me": "Удиви меня",
|
||||||
"no_results": "Ничего не найдено",
|
"no_results": "Ничего не найдено",
|
||||||
"hot": "🔥 Сейчас жарко",
|
"hot": "Сейчас жарко",
|
||||||
"start_typing": "Начинаю вводить текст для поиска...",
|
"start_typing": "Начинаю вводить текст для поиска...",
|
||||||
"weekly": "📅 Лучшие игры недели"
|
"weekly": "📅 Лучшие игры недели"
|
||||||
},
|
},
|
||||||
|
1735
src/renderer/src/assets/lottie/flame.json
Normal file
1735
src/renderer/src/assets/lottie/flame.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,3 @@
|
|||||||
import { useRef } from "react";
|
|
||||||
import Lottie from "lottie-react";
|
import Lottie from "lottie-react";
|
||||||
|
|
||||||
import downloadingAnimation from "@renderer/assets/lottie/downloading.json";
|
import downloadingAnimation from "@renderer/assets/lottie/downloading.json";
|
||||||
@ -8,11 +7,8 @@ export interface DownloadIconProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function DownloadIcon({ isDownloading }: DownloadIconProps) {
|
export function DownloadIcon({ isDownloading }: DownloadIconProps) {
|
||||||
const lottieRef = useRef(null);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Lottie
|
<Lottie
|
||||||
lottieRef={lottieRef}
|
|
||||||
animationData={downloadingAnimation}
|
animationData={downloadingAnimation}
|
||||||
loop={isDownloading}
|
loop={isDownloading}
|
||||||
autoplay={isDownloading}
|
autoplay={isDownloading}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useRef, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
@ -8,10 +8,11 @@ import { Button, GameCard, Hero } from "@renderer/components";
|
|||||||
import type { Steam250Game, CatalogueEntry } from "@types";
|
import type { Steam250Game, CatalogueEntry } from "@types";
|
||||||
|
|
||||||
import starsAnimation from "@renderer/assets/lottie/stars.json";
|
import starsAnimation from "@renderer/assets/lottie/stars.json";
|
||||||
|
import flameAnimation from "@renderer/assets/lottie/flame.json";
|
||||||
|
|
||||||
import * as styles from "./home.css";
|
import * as styles from "./home.css";
|
||||||
import { vars } from "@renderer/theme.css";
|
import { SPACING_UNIT, vars } from "@renderer/theme.css";
|
||||||
import Lottie from "lottie-react";
|
import Lottie, { type LottieRefCurrentProps } from "lottie-react";
|
||||||
import { buildGameDetailsPath } from "@renderer/helpers";
|
import { buildGameDetailsPath } from "@renderer/helpers";
|
||||||
import { CatalogueCategory } from "@shared";
|
import { CatalogueCategory } from "@shared";
|
||||||
|
|
||||||
@ -19,6 +20,8 @@ export function Home() {
|
|||||||
const { t } = useTranslation("home");
|
const { t } = useTranslation("home");
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const flameAnimationRef = useRef<LottieRefCurrentProps>(null);
|
||||||
|
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [randomGame, setRandomGame] = useState<Steam250Game | null>(null);
|
const [randomGame, setRandomGame] = useState<Steam250Game | null>(null);
|
||||||
|
|
||||||
@ -82,6 +85,18 @@ export function Home() {
|
|||||||
|
|
||||||
const categories = Object.values(CatalogueCategory);
|
const categories = Object.values(CatalogueCategory);
|
||||||
|
|
||||||
|
const handleMouseEnterCategory = (category: CatalogueCategory) => {
|
||||||
|
if (category === CatalogueCategory.Hot) {
|
||||||
|
flameAnimationRef?.current?.play();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleMouseLeaveCategory = (category: CatalogueCategory) => {
|
||||||
|
if (category === CatalogueCategory.Hot) {
|
||||||
|
flameAnimationRef?.current?.stop();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SkeletonTheme baseColor={vars.color.background} highlightColor="#444">
|
<SkeletonTheme baseColor={vars.color.background} highlightColor="#444">
|
||||||
<section className={styles.content}>
|
<section className={styles.content}>
|
||||||
@ -100,7 +115,28 @@ export function Home() {
|
|||||||
: "outline"
|
: "outline"
|
||||||
}
|
}
|
||||||
onClick={() => handleCategoryClick(category)}
|
onClick={() => handleCategoryClick(category)}
|
||||||
|
onMouseEnter={() => handleMouseEnterCategory(category)}
|
||||||
|
onMouseLeave={() => handleMouseLeaveCategory(category)}
|
||||||
>
|
>
|
||||||
|
{category === CatalogueCategory.Hot && (
|
||||||
|
<div
|
||||||
|
style={{ width: 16, height: 16, position: "relative" }}
|
||||||
|
>
|
||||||
|
<Lottie
|
||||||
|
lottieRef={flameAnimationRef}
|
||||||
|
animationData={flameAnimation}
|
||||||
|
loop
|
||||||
|
autoplay={false}
|
||||||
|
style={{
|
||||||
|
width: 30,
|
||||||
|
top: -10,
|
||||||
|
left: -5,
|
||||||
|
position: "absolute",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{t(category)}
|
{t(category)}
|
||||||
</Button>
|
</Button>
|
||||||
</li>
|
</li>
|
||||||
@ -116,14 +152,32 @@ export function Home() {
|
|||||||
<Lottie
|
<Lottie
|
||||||
animationData={starsAnimation}
|
animationData={starsAnimation}
|
||||||
style={{ width: 70, position: "absolute", top: -28, left: -27 }}
|
style={{ width: 70, position: "absolute", top: -28, left: -27 }}
|
||||||
loop
|
loop={Boolean(randomGame)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{t("surprise_me")}
|
{t("surprise_me")}
|
||||||
</Button>
|
</Button>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<h2>{t(currentCatalogueCategory)}</h2>
|
<h2 style={{ display: "flex", gap: SPACING_UNIT }}>
|
||||||
|
{currentCatalogueCategory === CatalogueCategory.Hot && (
|
||||||
|
<div style={{ width: 24, height: 24, position: "relative" }}>
|
||||||
|
<Lottie
|
||||||
|
animationData={flameAnimation}
|
||||||
|
loop
|
||||||
|
autoplay
|
||||||
|
style={{
|
||||||
|
width: 40,
|
||||||
|
top: -10,
|
||||||
|
left: -5,
|
||||||
|
position: "absolute",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{t(currentCatalogueCategory)}
|
||||||
|
</h2>
|
||||||
|
|
||||||
<section className={styles.cards}>
|
<section className={styles.cards}>
|
||||||
{isLoading
|
{isLoading
|
||||||
|
@ -155,6 +155,7 @@ export const listItemImage = style({
|
|||||||
width: "32px",
|
width: "32px",
|
||||||
height: "32px",
|
height: "32px",
|
||||||
borderRadius: "4px",
|
borderRadius: "4px",
|
||||||
|
objectFit: "cover",
|
||||||
});
|
});
|
||||||
|
|
||||||
export const listItemDetails = style({
|
export const listItemDetails = style({
|
||||||
|
Loading…
Reference in New Issue
Block a user