feat: adding user tags

This commit is contained in:
Chubby Granny Chaser 2024-12-20 18:39:40 +00:00
parent 3be9053b76
commit e78de55fe7
No known key found for this signature in database
4 changed files with 498 additions and 31 deletions

View File

@ -18,6 +18,7 @@ import { useNavigate, useSearchParams } from "react-router-dom";
import { FilterSection } from "./filter-section";
import { setSearch } from "@renderer/features";
import { useTranslation } from "react-i18next";
import { steamUserTags } from "./steam-user-tags";
export default function Catalogue() {
const inputRef = useRef<HTMLInputElement>(null);
@ -142,7 +143,7 @@ export default function Catalogue() {
{
downloadSources.find(
(source) => source.fingerprint === fingerprint
)!.name
)?.name
}
</Badge>
))}
@ -204,7 +205,7 @@ export default function Catalogue() {
fontSize: 12,
}}
>
{game.genres.join(", ")}
{game.genres?.join(", ")}
</span>
<div style={{ display: "flex", gap: 8, flexWrap: "wrap" }}>
@ -278,11 +279,13 @@ export default function Catalogue() {
"Gore",
"Documentary",
"Tutorial",
].map((genre) => ({
label: genre,
value: genre,
checked: filters.genres.includes(genre),
}))}
]
.sort()
.map((genre) => ({
label: genre,
value: genre,
checked: filters.genres.includes(genre),
}))}
/>
<FilterSection
@ -298,11 +301,13 @@ export default function Catalogue() {
dispatch(setSearch({ tags: [...filters.tags, value] }));
}
}}
items={[1, 2, 3, 4, 5].map((genre) => ({
label: genre.toString(),
value: genre,
checked: filters.tags.includes(genre),
}))}
items={Object.entries(steamUserTags)
.sort(([keyA], [keyB]) => keyA.localeCompare(keyB))
.map(([key, value]) => ({
label: key,
value: value,
checked: filters.tags.includes(value),
}))}
/>
<FilterSection

View File

@ -18,16 +18,23 @@ export function FilterSection<T extends string | number>({
onSelect,
}: FilterSectionProps<T>) {
const [search, setSearch] = useState("");
const [showMore, setShowMore] = useState(false);
const filteredItems = useMemo(() => {
if (items.length > 10 && search.length > 0) {
return items.filter((item) =>
item.label.toLowerCase().includes(search.toLowerCase())
);
if (search.length > 0) {
return items
.filter((item) =>
item.label.toLowerCase().includes(search.toLowerCase())
)
.slice(0, 10);
}
if (showMore) {
return items;
}
return items.slice(0, 10);
}, [items, search]);
}, [items, search, showMore]);
const onSearch = useCallback((value: string) => {
setSearch(value);
@ -70,19 +77,22 @@ export function FilterSection<T extends string | number>({
</div>
))}
<button
type="button"
style={{
color: "#fff",
fontSize: 14,
textAlign: "left",
marginTop: 8,
textDecoration: "underline",
cursor: "pointer",
}}
>
View more ({items.length - filteredItems.length})
</button>
{!search && items.length > 10 && (
<button
type="button"
style={{
color: "#fff",
fontSize: 14,
textAlign: "left",
marginTop: 8,
textDecoration: "underline",
cursor: "pointer",
}}
onClick={() => setShowMore(!showMore)}
>
{showMore ? "Show less" : `Show more (${items.length - 10})`}
</button>
)}
</div>
</div>
);

View File

@ -0,0 +1,452 @@
export const steamUserTags = {
Atmospheric: 4166,
Fantasy: 1684,
Relaxing: 1654,
Funny: 4136,
"Sci-fi": 3942,
Horror: 1667,
"Family Friendly": 5350,
Retro: 4004,
Survival: 1662,
Mystery: 5716,
Dark: 4342,
Comedy: 1719,
"Psychological Horror": 1721,
Sports: 701,
"Old School": 3916,
Medieval: 4172,
Magic: 4057,
Racing: 699,
Building: 1643,
Management: 12472,
Space: 1755,
Tactical: 1708,
Drama: 5984,
Futuristic: 4295,
Logic: 6129,
Romance: 4947,
Crafting: 1702,
"Dark Fantasy": 4604,
Emotional: 5608,
"Survival Horror": 3978,
"1980s": 7743,
Nature: 30358,
Education: 1036,
"1990's": 6691,
Surreal: 1710,
"Post-apocalyptic": 3835,
War: 1678,
Zombies: 1659,
Historical: 3987,
Stealth: 1687,
Investigation: 8369,
Military: 4168,
"LGBTQ+": 44868,
Cyberpunk: 4115,
"Lore-Rich": 3854,
Detective: 5613,
Aliens: 1673,
Thriller: 4064,
Economy: 4695,
Robots: 5752,
Demons: 9541,
"Dark Humor": 5923,
Psychological: 5186,
Driving: 1644,
Supernatural: 10808,
"Comic Book": 1751,
Modern: 5673,
Psychedelic: 1714,
Dystopian: 5030,
Flight: 15045,
"Artificial Intelligence": 7926,
Loot: 4236,
Memes: 10397,
"Alternate History": 4598,
Cats: 17894,
Parkour: 4036,
Mythology: 16094,
Crime: 6378,
"Game Development": 13906,
Destruction: 5363,
Philosophical: 15277,
Capitalism: 4845,
"Dark Comedy": 19995,
Automation: 255534,
Lovecraftian: 7432,
Noir: 6052,
Swordplay: 4608,
Science: 5794,
Cooking: 3920,
America: 13190,
Dragons: 4046,
"World War II": 4150,
Parody: 4878,
Agriculture: 22602,
Conspiracy: 5372,
Gothic: 3952,
"Martial Arts": 6915,
Mechs: 4821,
Underground: 21006,
Satire: 1651,
Pirates: 1681,
Steampunk: 1777,
Dog: 1638,
"Time Travel": 10679,
Mining: 5981,
Transportation: 10383,
Ninja: 1688,
Vampire: 4018,
Tanks: 13276,
Political: 4853,
Otome: 31579,
Underwater: 9157,
Hunting: 9564,
Fishing: 15564,
Trains: 1616,
Dinosaurs: 5160,
Western: 1647,
Hacking: 5502,
Faith: 180368,
Programming: 5432,
Superhero: 1671,
Politics: 4754,
Assassin: 4376,
Gambling: 16250,
Naval: 6910,
Diplomacy: 6310,
Heist: 1680,
Snow: 9803,
Archery: 13382,
"Cold War": 5179,
Sailing: 13577,
"Football (Soccer)": 1254546,
Foreign: 51306,
Offroad: 7622,
Horses: 6041,
Illuminati: 7478,
Sniper: 7423,
Transhumanism: 4137,
Werewolves: 17015,
Mars: 6702,
Boxing: 12190,
Jet: 92092,
Motorbike: 198913,
Golf: 7038,
Bikes: 123332,
"World War I": 5382,
Rome: 6948,
Submarine: 19780,
Basketball: 1746,
Baseball: 5727,
LEGO: 1736,
Skateboarding: 1753,
"Mini Golf": 22955,
Wrestling: 47827,
"Football (American)": 1254552,
Tennis: 5914,
Pool: 17927,
Skating: 96359,
Cycling: 19568,
Motocross: 15868,
"Warhammer 40K": 12286,
Lemmings: 17337,
Hockey: 324176,
Bowling: 7328,
Snowboarding: 28444,
Skiing: 7309,
BMX: 252854,
ATV: 129761,
Indie: 492,
Action: 19,
Casual: 597,
Adventure: 21,
Simulation: 599,
RPG: 122,
Strategy: 9,
"Action-Adventure": 4106,
Software: 8013,
"2D": 3871,
"3D": 4191,
Colorful: 4305,
"Pixel Graphics": 3964,
Cute: 4726,
"First-Person": 3839,
Anime: 4085,
"Third Person": 1697,
Stylized: 4252,
"Top-Down": 4791,
Realistic: 4175,
Cartoony: 4195,
Minimalist: 4094,
"Hand-drawn": 6815,
VR: 21978,
Cartoon: 4562,
"Text-Based": 31275,
Cinematic: 4145,
"2.5D": 4975,
Isometric: 5851,
Abstract: 4400,
"Split Screen": 10816,
"3D Vision": 29363,
Voxel: 1732,
Beautiful: 5411,
FMV: 18594,
"360 Video": 776177,
"Story Rich": 1742,
Combat: 3993,
Controller: 7481,
"Female Protagonist": 7208,
"Choices Matter": 6426,
"Open World": 1695,
PvP: 1775,
PvE: 6730,
Linear: 7250,
"Multiple Endings": 6971,
Physics: 3968,
"Character Customization": 4747,
"Procedural Generation": 5125,
Tabletop: 17389,
"Turn-Based Combat": 4325,
"Turn-Based Tactics": 14139,
"Hack and Slash": 1646,
"Resource Management": 8945,
"Base-Building": 7332,
"Score Attack": 5154,
Narration: 5094,
Conversation: 15172,
Nonlinear: 6869,
Tutorial: 12057,
"Perma Death": 1759,
"Team-Based": 5711,
Deckbuilding: 32322,
"Inventory Management": 6276,
"Level Editor": 8122,
"Grid-Based Movement": 7569,
Moddable: 1669,
"Class-Based": 4155,
"Vehicular Combat": 11104,
"Gun Customization": 5765,
"6DOF": 4835,
Trading: 4202,
"Bullet Time": 5796,
"Time Manipulation": 6625,
"Quick-Time Events": 4559,
"Dynamic Narration": 9592,
"Hex Grid": 1717,
"Naval Combat": 4994,
"Music-Based Procedural Generation": 8253,
"Asymmetric VR": 856791,
Puzzle: 1664,
Arcade: 1773,
Shooter: 1774,
Platformer: 1625,
"Visual Novel": 3799,
Sandbox: 3810,
"Rogue-like": 1716,
"Action RPG": 4231,
"Point & Click": 1698,
"Action Roguelike": 42804,
"Interactive Fiction": 11014,
"Turn-Based Strategy": 1741,
"Dating Sim": 9551,
JRPG: 4434,
"Party-Based RPG": 10695,
"Walking Simulator": 5900,
"Design & Illustration": 84,
"Card Game": 1666,
"Life Sim": 10235,
Utilities: 87,
"Strategy RPG": 17305,
"Board Game": 1770,
RTS: 1676,
"Tower Defense": 1645,
"Web Publishing": 1038,
"City Builder": 4328,
"Beat 'em up": 4158,
"Automobile Sim": 1100687,
"2D Fighter": 4736,
Rhythm: 1752,
"3D Fighter": 6506,
"Farming Sim": 87918,
"Animation & Modeling": 872,
"e-sports": 5055,
"Grand Strategy": 4364,
"Space Sim": 16598,
"Colony Sim": 220585,
"Word Game": 24003,
"Battle Royale": 176981,
MMORPG: 1754,
"Auto Battler": 1084988,
"Audio Production": 1027,
"Video Production": 784,
"God Game": 5300,
"4X": 1670,
MOBA: 1718,
"Photo Editing": 809,
Trivia: 10437,
"Immersive Sim": 9204,
"Political Sim": 26921,
"Outbreak Sim": 1100686,
"Medical Sim": 1100688,
Short: 4234,
Movie: 4700,
Episodic: 4242,
Gaming: 150626,
Documentary: 15339,
Exploration: 3834,
"2D Platformer": 5379,
FPS: 1663,
"Rogue-lite": 3959,
"Shoot 'Em Up": 4255,
"3D Platformer": 5395,
"Side Scroller": 3798,
"Choose Your Own Adventure": 4486,
"Puzzle-Platformer": 5537,
"Hidden Object": 1738,
"Bullet Hell": 4885,
"Dungeon Crawler": 1720,
"Top-Down Shooter": 4637,
Clicker: 379975,
"Third-Person Shooter": 3814,
"Precision Platformer": 3877,
"Time Management": 16689,
"Real Time Tactics": 3813,
"Arena Shooter": 5547,
Collectathon: 5652,
"Tactical RPG": 21725,
Idler: 615955,
Wargame: 4684,
Metroidvania: 1628,
Runner: 8666,
"Card Battler": 791774,
"Souls-like": 29482,
CRPG: 4474,
"Creature Collector": 916648,
"Twin Stick Shooter": 4758,
"Match 3": 1665,
"Mystery Dungeon": 198631,
"Hero Shooter": 620519,
"Spectacle fighter": 4777,
"Looter Shooter": 353880,
Solitaire: 13070,
"Combat Racing": 4102,
"Action RTS": 1723,
Sokoban: 1730,
"Trading Card Game": 9271,
Typing: 1674,
"Boomer Shooter": 1023537,
"Traditional Roguelike": 454187,
"On-Rails Shooter": 56690,
Spelling: 71389,
Roguevania: 922563,
Singleplayer: 4182,
Multiplayer: 3859,
"Co-op": 1685,
"Online Co-Op": 3843,
"Massively Multiplayer": 128,
"Local Multiplayer": 7368,
"Local Co-Op": 3841,
"4 Player Local": 4840,
"Co-op Campaign": 4508,
"Asynchronous Multiplayer": 17770,
"Profile Features Limited": 1003823,
"Demo Available": 21491,
"Adult Content": 65443,
Hentai: 9130,
Fighting: 1743,
Classic: 1693,
Cozy: 97376,
"Open World Survival Craft": 1100689,
Wholesome: 552282,
"Roguelike Deckbuilder": 1091588,
Narrative: 7702,
Immersive: 3934,
"Party Game": 7178,
Party: 7108,
"Escape Room": 769306,
Addictive: 4190,
Nostalgia: 14720,
Farming: 4520,
"Cult Classic": 7782,
Spaceships: 4291,
"Electronic Music": 61357,
Pinball: 6621,
"Social Deduction": 745697,
Ambient: 29855,
Dwarf: 7918,
"Job Simulator": 35079,
Epic: 3965,
"Instrumental Music": 189941,
"Jump Scare": 42089,
"Boss Rush": 11095,
"Rock Music": 337964,
"Tile-Matching": 176733,
Vikings: 11634,
"Extraction Shooter": 1199779,
"8-bit Music": 117648,
"Well-Written": 8461,
Mahjong: 33572,
"Shop Keeper": 91114,
Electronic: 143739,
Birds: 6214,
Dice: 7556,
Musou: 323922,
Fox: 30927,
Coding: 42329,
Elf: 102530,
"Hobby Sim": 1220528,
Cricket: 158638,
Rugby: 49213,
Volleyball: 847164,
Snooker: 363767,
Reboot: 5941,
"Based On A Novel": 3796,
"Free to Play": 113,
"Early Access": 493,
Experimental: 13782,
"Software Training": 1445,
Minigames: 8093,
Remake: 5708,
Sequel: 5230,
Experience: 9994,
Kickstarter: 5153,
Crowdfunded: 7113,
Benchmark: 5407,
"Feature Film": 233824,
Difficult: 4026,
Competitive: 3878,
Unforgiving: 1733,
"Turn-Based": 1677,
"Replay Value": 4711,
"Fast-Paced": 1734,
"Real-Time": 4161,
"Real-Time with Pause": 7107,
"Time Attack": 5390,
"Sexual Content": 12095,
Nudity: 6650,
Mature: 5611,
NSFW: 24904,
"Character Action Game": 3955,
"Villain Protagonist": 11333,
"Silent Protagonist": 15954,
Chess: 4184,
Violent: 4667,
Gore: 4345,
Blood: 5228,
Soundtrack: 7948,
"Great Soundtrack": 1756,
Music: 1621,
"Mouse only": 11123,
"Touch-Friendly": 25085,
"Intentionally Awkward Controls": 14906,
"Voice Control": 27758,
Mod: 5348,
RPGMaker: 5577,
GameMaker: 1649,
"Dungeons & Dragons": 14153,
"Games Workshop": 5310,
TrackIR: 8075,
Hardware: 603297,
"Steam Machine": 348922,
};

View File

@ -77,7 +77,7 @@ const addNewDownloads = async (
const getSteamGames = async () => {
const response = await axios.get<SteamGamesByLetter>(
"https://assets.hydralauncher.gg/steam-games-by-letter.json"
`${import.meta.env.RENDERER_VITE_EXTERNAL_RESOURCES_URL}/steam-games-by-letter.json`
);
return response.data;