mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-11 13:56:16 +00:00
feat: improving ui for download source filter
This commit is contained in:
@@ -21,11 +21,9 @@ const getGameStats = async (
|
|||||||
return cachedStats;
|
return cachedStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
return HydraApi.get<GameStats>(
|
return HydraApi.get<GameStats>(`/games/${shop}/${objectId}/stats`, null, {
|
||||||
`/games/stats`,
|
needsAuth: false,
|
||||||
{ objectId, shop },
|
}).then(async (data) => {
|
||||||
{ needsAuth: false }
|
|
||||||
).then(async (data) => {
|
|
||||||
await gamesStatsCacheSublevel.put(levelKeys.game(shop, objectId), {
|
await gamesStatsCacheSublevel.put(levelKeys.game(shop, objectId), {
|
||||||
...data,
|
...data,
|
||||||
updatedAt: Date.now(),
|
updatedAt: Date.now(),
|
||||||
|
|||||||
@@ -8,12 +8,7 @@ const getHowLongToBeat = async (
|
|||||||
objectId: string,
|
objectId: string,
|
||||||
shop: GameShop
|
shop: GameShop
|
||||||
): Promise<HowLongToBeatCategory[] | null> => {
|
): Promise<HowLongToBeatCategory[] | null> => {
|
||||||
const params = new URLSearchParams({
|
return HydraApi.get(`/games/${shop}/${objectId}/how-long-to-beat`, null, {
|
||||||
objectId,
|
|
||||||
shop,
|
|
||||||
});
|
|
||||||
|
|
||||||
return HydraApi.get(`/games/how-long-to-beat?${params.toString()}`, null, {
|
|
||||||
needsAuth: false,
|
needsAuth: false,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const getTrendingGames = async (_event: Electron.IpcMainInvokeEvent) => {
|
|||||||
.then((language) => language || "en");
|
.then((language) => language || "en");
|
||||||
|
|
||||||
const trendingGames = await HydraApi.get<TrendingGame[]>(
|
const trendingGames = await HydraApi.get<TrendingGame[]>(
|
||||||
"/games/featured",
|
"/catalogue/featured",
|
||||||
{ language },
|
{ language },
|
||||||
{ needsAuth: false }
|
{ needsAuth: false }
|
||||||
).catch(() => []);
|
).catch(() => []);
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ const createSteamShortcut = async (
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { assets } = await HydraApi.get<GameStats>(
|
const { assets } = await HydraApi.get<GameStats>(
|
||||||
`/games/stats?objectId=${objectId}&shop=${shop}`
|
`/games/${shop}/${objectId}/stats`
|
||||||
);
|
);
|
||||||
|
|
||||||
const steamUserIds = await getSteamUsersIds();
|
const steamUserIds = await getSteamUsersIds();
|
||||||
|
|||||||
@@ -93,14 +93,9 @@ const startGameDownload = async (
|
|||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
createGame(updatedGame!).catch(() => {}),
|
createGame(updatedGame!).catch(() => {}),
|
||||||
HydraApi.post(
|
HydraApi.post(`/games/${shop}/${objectId}/download`, null, {
|
||||||
"/games/download",
|
needsAuth: false,
|
||||||
{
|
}).catch(() => {}),
|
||||||
objectId,
|
|
||||||
shop,
|
|
||||||
},
|
|
||||||
{ needsAuth: false }
|
|
||||||
).catch(() => {}),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return { ok: true };
|
return { ok: true };
|
||||||
|
|||||||
@@ -45,10 +45,8 @@ export const getGameAchievementData = async (
|
|||||||
.then((language) => language || "en");
|
.then((language) => language || "en");
|
||||||
|
|
||||||
return HydraApi.get<SteamAchievement[]>(
|
return HydraApi.get<SteamAchievement[]>(
|
||||||
"/games/achievements",
|
`/games/${shop}/${objectId}/achievements`,
|
||||||
{
|
{
|
||||||
shop,
|
|
||||||
objectId,
|
|
||||||
language,
|
language,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,9 +16,7 @@ export const friendGameSessionEvent = async (payload: FriendGameSession) => {
|
|||||||
|
|
||||||
const [friend, gameStats] = await Promise.all([
|
const [friend, gameStats] = await Promise.all([
|
||||||
HydraApi.get<UserProfile>(`/users/${payload.friendId}`),
|
HydraApi.get<UserProfile>(`/users/${payload.friendId}`),
|
||||||
HydraApi.get<GameStats>(
|
HydraApi.get<GameStats>(`/games/steam/${payload.objectId}/stats`),
|
||||||
`/games/stats?objectId=${payload.objectId}&shop=steam`
|
|
||||||
),
|
|
||||||
]).catch(() => [null, null]);
|
]).catch(() => [null, null]);
|
||||||
|
|
||||||
if (friend && gameStats) {
|
if (friend && gameStats) {
|
||||||
|
|||||||
@@ -2,37 +2,33 @@
|
|||||||
|
|
||||||
.repacks-modal {
|
.repacks-modal {
|
||||||
&__filter-container {
|
&__filter-container {
|
||||||
margin-bottom: 1rem;
|
transition: all 0.3s ease;
|
||||||
transition: min-height 0.3s ease;
|
|
||||||
|
|
||||||
&--drawer-open {
|
|
||||||
min-height: 250px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&__filter-top {
|
&__filter-top {
|
||||||
margin-bottom: 1rem;
|
margin-bottom: calc(globals.$spacing-unit * 2);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: row;
|
||||||
gap: 0.5rem;
|
gap: calc(globals.$spacing-unit * 1);
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__filter-toggle {
|
&__filter-toggle {
|
||||||
align-self: flex-start;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.5rem;
|
gap: calc(globals.$spacing-unit * 1);
|
||||||
font-size: globals.$small-font-size;
|
font-size: globals.$small-font-size;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: var(--color-text-secondary);
|
color: var(--color-text-secondary);
|
||||||
padding: 0.5rem 0.75rem;
|
padding: calc(globals.$spacing-unit * 1) calc(globals.$spacing-unit * 1.5);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
transition: background-color 0.2s ease;
|
transition: background-color 0.2s ease;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__repacks {
|
&__repacks {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: globals.$spacing-unit;
|
gap: calc(globals.$spacing-unit * 2);
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +37,7 @@
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
gap: globals.$spacing-unit;
|
gap: calc(globals.$spacing-unit * 1);
|
||||||
color: globals.$body-color;
|
color: globals.$body-color;
|
||||||
padding: calc(globals.$spacing-unit * 2);
|
padding: calc(globals.$spacing-unit * 2);
|
||||||
}
|
}
|
||||||
@@ -91,8 +87,8 @@
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
background-color: var(--color-background-light);
|
background-color: var(--color-background-light);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
margin-bottom: 1rem;
|
margin-bottom: calc(globals.$spacing-unit * 2);
|
||||||
margin-top: calc(globals.$spacing-unit * 0.5);
|
margin-top: calc(globals.$spacing-unit * 1);
|
||||||
max-height: 0;
|
max-height: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
transition:
|
transition:
|
||||||
@@ -100,8 +96,7 @@
|
|||||||
padding 0.3s ease;
|
padding 0.3s ease;
|
||||||
|
|
||||||
&--open {
|
&--open {
|
||||||
padding: 0.75rem;
|
max-height: 280px;
|
||||||
max-height: 250px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,24 +112,30 @@
|
|||||||
&__source-grid {
|
&__source-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, 1fr);
|
grid-template-columns: repeat(3, 1fr);
|
||||||
gap: 0.5rem;
|
gap: calc(globals.$spacing-unit * 1);
|
||||||
max-height: 200px;
|
max-height: 200px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
align-items: start;
|
align-items: start;
|
||||||
padding-right: 0.25rem;
|
padding: calc(globals.$spacing-unit * 0.5) calc(globals.$spacing-unit * 0.5)
|
||||||
|
calc(globals.$spacing-unit * 0.5) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__source-item {
|
&__source-item {
|
||||||
padding: 0.35rem 0.5rem;
|
padding: calc(globals.$spacing-unit * 0.75) calc(globals.$spacing-unit * 1);
|
||||||
background: var(--color-surface, rgba(0, 0, 0, 0.03));
|
background: var(--color-surface, rgba(0, 0, 0, 0.03));
|
||||||
border: 1px solid var(--color-border);
|
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
min-height: auto;
|
min-height: calc(globals.$spacing-unit * 5);
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
transition: border-color 0.2s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-color: rgba(255, 255, 255, 0.2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__source-item :global(.checkbox-field) {
|
&__source-item :global(.checkbox-field) {
|
||||||
|
|||||||
@@ -181,15 +181,17 @@ export function RepacksModal({
|
|||||||
>
|
>
|
||||||
<div className="repacks-modal__filter-top">
|
<div className="repacks-modal__filter-top">
|
||||||
<TextField placeholder={t("filter")} onChange={handleFilter} />
|
<TextField placeholder={t("filter")} onChange={handleFilter} />
|
||||||
<Button
|
{downloadSources.length > 0 && (
|
||||||
type="button"
|
<Button
|
||||||
theme="outline"
|
type="button"
|
||||||
onClick={() => setIsFilterDrawerOpen(!isFilterDrawerOpen)}
|
theme="outline"
|
||||||
className="repacks-modal__filter-toggle"
|
onClick={() => setIsFilterDrawerOpen(!isFilterDrawerOpen)}
|
||||||
>
|
className="repacks-modal__filter-toggle"
|
||||||
{t("filter_by_source")}
|
>
|
||||||
{isFilterDrawerOpen ? <ChevronUpIcon /> : <ChevronDownIcon />}
|
{t("filter_by_source")}
|
||||||
</Button>
|
{isFilterDrawerOpen ? <ChevronUpIcon /> : <ChevronDownIcon />}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -133,13 +133,6 @@
|
|||||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
||||||
transition: all ease 0.2s;
|
transition: all ease 0.2s;
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: rgba(0, 0, 0, 0.5);
|
|
||||||
border-color: rgba(255, 255, 255, 0.25);
|
|
||||||
transform: translateY(-1px);
|
|
||||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
|
|
||||||
}
|
|
||||||
|
|
||||||
&-long {
|
&-long {
|
||||||
display: inline;
|
display: inline;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
|||||||
Reference in New Issue
Block a user