From 75bc1827e4d77512e933cb19ff7f042b32ab50d0 Mon Sep 17 00:00:00 2001 From: Blossomi Shymae <87099578+BlossomiShymae@users.noreply.github.com> Date: Wed, 1 May 2024 20:38:02 -0500 Subject: [PATCH] Init commit --- .gitignore | 24 + .gitmodules | 3 + README.md | 73 + app.vue | 27 + components/Badge.vue | 18 + components/MaterialIcon.vue | 19 + components/Pagination.vue | 41 + components/TheTitle.vue | 3 + composables/useClient.ts | 9 + core/client.ts | 70 + core/models.ts | 282 + layouts/default.vue | 128 + nuxt.config.ts | 62 + package-lock.json | 10647 ++++++++++++++++++++++++++++++++ package.json | 21 + pages/about.vue | 53 + pages/index.vue | 57 + pages/items/index.vue | 49 + pages/items/overview/[id].vue | 68 + preview.png | Bin 0 -> 761825 bytes public/.nojekyll | 0 public/css/app.css | 133 + public/favicon.ico | Bin 0 -> 4286 bytes public/img/avatar.png | Bin 0 -> 352493 bytes public/img/error.png | Bin 0 -> 12298 bytes public/lib/MaterialDesign | 1 + server/tsconfig.json | 3 + tsconfig.json | 4 + utils/paginated-array.ts | 50 + 29 files changed, 11845 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 README.md create mode 100644 app.vue create mode 100644 components/Badge.vue create mode 100644 components/MaterialIcon.vue create mode 100644 components/Pagination.vue create mode 100644 components/TheTitle.vue create mode 100644 composables/useClient.ts create mode 100644 core/client.ts create mode 100644 core/models.ts create mode 100644 layouts/default.vue create mode 100644 nuxt.config.ts create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 pages/about.vue create mode 100644 pages/index.vue create mode 100644 pages/items/index.vue create mode 100644 pages/items/overview/[id].vue create mode 100644 preview.png create mode 100644 public/.nojekyll create mode 100644 public/css/app.css create mode 100644 public/favicon.ico create mode 100644 public/img/avatar.png create mode 100644 public/img/error.png create mode 160000 public/lib/MaterialDesign create mode 100644 server/tsconfig.json create mode 100644 tsconfig.json create mode 100644 utils/paginated-array.ts diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4a7f73a --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +# Nuxt dev/build outputs +.output +.data +.nuxt +.nitro +.cache +dist + +# Node dependencies +node_modules + +# Logs +logs +*.log + +# Misc +.DS_Store +.fleet +.idea + +# Local env files +.env +.env.* +!.env.example diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..1da49b7 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "public/lib/MaterialDesign"] + path = public/lib/MaterialDesign + url = git@github.com:Templarian/MaterialDesign.git diff --git a/README.md b/README.md new file mode 100644 index 0000000..9684b77 --- /dev/null +++ b/README.md @@ -0,0 +1,73 @@ +# Clean Cuts + +![](preview.png) + +## Setup + +Make sure to install the dependencies: + +```bash +# npm +npm install + +# pnpm +pnpm install + +# yarn +yarn install + +# bun +bun install +``` + +## Development Server + +Start the development server on `http://localhost:3000`: + +```bash +# npm +npm run dev + +# pnpm +pnpm run dev + +# yarn +yarn dev + +# bun +bun run dev +``` + +## Production + +Build the application for production: + +```bash +# npm +npm run build + +# pnpm +pnpm run build + +# yarn +yarn build + +# bun +bun run build +``` + +Locally preview production build: + +```bash +# npm +npm run preview + +# pnpm +pnpm run preview + +# yarn +yarn preview + +# bun +bun run preview +``` \ No newline at end of file diff --git a/app.vue b/app.vue new file mode 100644 index 0000000..d1440a9 --- /dev/null +++ b/app.vue @@ -0,0 +1,27 @@ + + + diff --git a/components/Badge.vue b/components/Badge.vue new file mode 100644 index 0000000..0de5198 --- /dev/null +++ b/components/Badge.vue @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/components/MaterialIcon.vue b/components/MaterialIcon.vue new file mode 100644 index 0000000..c923587 --- /dev/null +++ b/components/MaterialIcon.vue @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/components/Pagination.vue b/components/Pagination.vue new file mode 100644 index 0000000..664aad9 --- /dev/null +++ b/components/Pagination.vue @@ -0,0 +1,41 @@ + + + + + \ No newline at end of file diff --git a/components/TheTitle.vue b/components/TheTitle.vue new file mode 100644 index 0000000..9237640 --- /dev/null +++ b/components/TheTitle.vue @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/composables/useClient.ts b/composables/useClient.ts new file mode 100644 index 0000000..ca3faaa --- /dev/null +++ b/composables/useClient.ts @@ -0,0 +1,9 @@ +import { Client } from "~/core/client"; + +const client = new Client(); + +export default function useClient(): { client: Client } { + return { + client + } +}; \ No newline at end of file diff --git a/core/client.ts b/core/client.ts new file mode 100644 index 0000000..4efea3d --- /dev/null +++ b/core/client.ts @@ -0,0 +1,70 @@ +import { ChampionSummary, Item, LocaleVersionArgs, Perk, SummonerEmote, SummonerIcon, WardSkin } from "./models"; +import axios from "axios"; + +export abstract class ApiObject { + static url = "https://raw.communitydragon.org"; + + getClientPath(args: LocaleVersionArgs): string { + return `${ApiObject.url}/${args.version}/plugins/rcp-be-lol-game-data/global/${args.locale}`; + } +} + +export class Client { + public items: ItemApi; + public perks: PerkApi; + public championSummaries: ChampionSummaryApi; + public summonerEmotes: SummonerEmoteApi; + public summonerIcons: SummonerIconApi; + public wardSkins: WardSkinApi; + + constructor() { + this.items = new ItemApi(); + this.perks = new PerkApi(); + this.championSummaries = new ChampionSummaryApi(); + this.summonerEmotes = new SummonerEmoteApi(); + this.summonerIcons = new SummonerIconApi(); + this.wardSkins = new WardSkinApi(); + } +} + +export class ItemApi extends ApiObject { + async listAsync(args: LocaleVersionArgs): Promise> { + let res = await axios.get(`${this.getClientPath(args)}/v1/items.json`); + return res.data.map((x: any) => new Item(x)); + } +} + +export class PerkApi extends ApiObject { + async listAsync(args: LocaleVersionArgs): Promise> { + let res = await axios.get(`${this.getClientPath(args)}/v1/perks.json`); + return res.data.map((x: any) => new Perk(x)); + } +} + +export class ChampionSummaryApi extends ApiObject { + async listAsync(args: LocaleVersionArgs): Promise> { + let res = await axios.get(`${this.getClientPath(args)}/v1/champion-summary.json`); + return res.data.map((x: any) => new ChampionSummary(x)); + } +} + +export class SummonerEmoteApi extends ApiObject { + async listAsync(args: LocaleVersionArgs): Promise> { + let res = await axios.get(`${this.getClientPath(args)}/v1/summoner-emotes.json`); + return res.data.map((x: any) => new SummonerEmote(x)); + } +} + +export class SummonerIconApi extends ApiObject { + async listAsync(args: LocaleVersionArgs): Promise> { + let res = await axios.get(`${this.getClientPath(args)}/v1/summoner-icons.json`); + return res.data.map((x: any) => new SummonerEmote(x)); + } +} + +export class WardSkinApi extends ApiObject { + async listAsync(args: LocaleVersionArgs): Promise> { + let res = await axios.get(`${this.getClientPath(args)}/v1/ward-skins.json`); + return res.data.map((x: any) => new WardSkin(x)); + } +} \ No newline at end of file diff --git a/core/models.ts b/core/models.ts new file mode 100644 index 0000000..e00f02b --- /dev/null +++ b/core/models.ts @@ -0,0 +1,282 @@ + +export class LocaleVersionArgs { + locale: string; + version: string + + constructor({locale, version}: {locale: string, version: string}) { + this.locale = locale; + this.version = version; + } +} + +export abstract class CommunityDragonObject { + static url = "https://raw.communitydragon.org"; + + resolveClientPath({path, args}: {path: string, args: LocaleVersionArgs}): string { + const uri = path.replace("/lol-game-data/assets", "").toLowerCase(); + return `${CommunityDragonObject.url}/${args.version}/plugins/rcp-be-lol-game-data/global/${args.locale}/${uri}`; + } + + resolveGamePath({path, version}: {path: string, version: string}): string { + const uri = path.replace("/lol-game-data/assets/ASSETS/", "").replace(".jpg", ".png").toLowerCase(); + return `${CommunityDragonObject.url}/${version}/game/assets/${uri}`; + } +} + +export class Champion extends CommunityDragonObject { + id: number; + name: string; + alias: string; + title: string; + shortBio: string; + playstyleInfo: PlaystyleInfo; + skins: Array; + passive: Passive; + spells: Array; + + constructor(json: any) { + super(); + + this.id = json.id; + this.name = json.name; + this.alias = json.alias; + this.title = json.title; + this.shortBio = json.shortBio; + this.playstyleInfo = new PlaystyleInfo(json.playstyleInfo); + this.skins = json.skins.map((x: any) => new Skin(x)); + this.passive = new Passive(json.passive); + this.spells = json.spells.map((x: any) => new Spell(x)); + } +} + +export class PlaystyleInfo extends CommunityDragonObject { + damage: number; + durability: number; + crowdControl: number; + mobility: number; + utility: number; + + constructor(json: any) { + super(); + + this.damage = json.damage; + this.durability = json.durability; + this.crowdControl = json.crowdControl; + this.mobility = json.mobility; + this.utility = json.utility; + } +} + +export class Skin extends CommunityDragonObject { + id: number; + isBase: boolean; + name: string; + rarity: string; + isLegacy: boolean; + loadScreenPath: string; + + constructor(json: any) { + super(); + + this.id = json.id; + this.isBase = json.isBase; + this.name = json.name; + this.rarity = json.rarity; + this.isLegacy = json.isLegacy; + this.loadScreenPath = json.loadScreenPath; + } + + getLoadScreen(version: string): string { + return this.resolveGamePath({path: this.loadScreenPath, version: version}); + } +} + +export class Passive extends CommunityDragonObject { + name: string; + description: string; + + constructor(json: any) { + super(); + + this.name = json.name; + this.description = json.description; + } +} + +export class Spell extends CommunityDragonObject { + spellKey: string; + name: string; + description: string; + + constructor(json: any) { + super(); + + this.spellKey = json.spellKey; + this.name = json.name; + this.description = json.description; + } +} + +export class ChampionSummary extends CommunityDragonObject { + id: number; + name: string; + alias: string; + squarePortraitPath: string; + + constructor(json: any) { + super(); + + this.id = json.id; + this.name = json.name; + this.alias = json.alias; + this.squarePortraitPath = json.squarePortraitPath; + } + + getIcon(args: LocaleVersionArgs): string { + return this.resolveClientPath({path: this.squarePortraitPath, args: args}); + } +} + +export class Item extends CommunityDragonObject { + id: number; + name: string; + description: string; + active: boolean; + inStore: boolean; + from: Array; + to: Array; + categories: Array; + price: number; + priceTotal: number; + iconPath: string; + + constructor(json: any) { + super(); + + this.id = json.id; + this.name = json.name; + this.description = json.description; + this.active = json.active; + this.inStore = json.inStore; + this.from = json.from; + this.to = json.to; + this.categories = json.categories; + this.price = json.price; + this.priceTotal = json.priceTotal; + this.iconPath = json.iconPath; + } + + getIcon(version: string): string { + return this.resolveGamePath({path: this.iconPath, version: version}); + } +} + +export class Perk extends CommunityDragonObject { + id: number; + name: string; + shortDesc: string; + longDesc: string; + iconPath: string; + + constructor(json: any) { + super(); + + this.id = json.id; + this.name = json.name; + this.shortDesc = json.shortDesc; + this.longDesc = json.longDesc; + this.iconPath = json.iconPath; + } + + getIcon(version: string): string { + return this.resolveClientPath({path: this.iconPath, args: {version: version, locale: "default"}}); + } +} + +export class SummonerEmote extends CommunityDragonObject { + id: number; + name: string; + inventoryIcon: string; + + constructor(json: any) { + super(); + + this.id = json.id; + this.name = json.name; + this.inventoryIcon = json.inventoryIcon; + } + + getInventoryIcon(version: string): string { + return this.resolveGamePath({path: this.inventoryIcon, version: version}).replace("inventory", "vfx"); + } +} + +export class SummonerIcon extends CommunityDragonObject { + id: number; + title: string; + yearReleased: number; + isLegacy: boolean; + imagePath?: string; + descriptions: Array; + rarities: Array; + + constructor(json: any) { + super(); + + this.id = json.id; + this.title = json.title; + this.yearReleased = json.yearReleased; + this.isLegacy = json.isLegacy; + this.imagePath = json.imagePath; + this.descriptions = json.descriptions.map((x: any) => new Description(x)); + this.rarities = json.rarities.map((x: any) => new Rarity(x)); + } +} + +export class WardSkin extends CommunityDragonObject { + id: number; + name: string; + description : string; + wardImagePath: string; + wardShadowImagePath: string; + isLegacy: boolean; + regionDescriptions: Array; + rarities: Array; + + constructor(json: any) { + super(); + + this.id = json.id; + this.name = json.name; + this.description = json.description; + this.wardImagePath = json.wardImagePath; + this.wardShadowImagePath = json.wardShadowImagePath; + this.isLegacy = json.isLegacy; + this.regionDescriptions = json.regionalDescriptions.map((x: any) => new Description(x)); + this.rarities = json.rarities.map((x: any) => new Rarity(x)); + } +} + +export class Description extends CommunityDragonObject { + region: string; + description: string; + + constructor(json: any) { + super(); + + this.region = json.region; + this.description = json.description; + } +} + +export class Rarity extends CommunityDragonObject { + region: string; + rarity: string; + + constructor(json: any) { + super(); + + this.region = json.region; + this.rarity = json.rarity; + } +} \ No newline at end of file diff --git a/layouts/default.vue b/layouts/default.vue new file mode 100644 index 0000000..f6b9a53 --- /dev/null +++ b/layouts/default.vue @@ -0,0 +1,128 @@ + +