diff --git a/src/routes/database/characters/[id]/+page.server.ts b/src/routes/database/characters/[id]/+page.server.ts new file mode 100644 index 00000000..3a650851 --- /dev/null +++ b/src/routes/database/characters/[id]/+page.server.ts @@ -0,0 +1,25 @@ +import type { PageServerLoad } from './$types' +import { get } from '$lib/api/core' +import { error } from '@sveltejs/kit' + +export const load: PageServerLoad = async ({ params, fetch }) => { + try { + const character = await get(fetch, `/characters/${params.id}`) + + if (!character) { + throw error(404, 'Character not found') + } + + return { + character + } + } catch (err) { + console.error('Failed to load character:', err) + + if (err instanceof Error && 'status' in err && err.status === 404) { + throw error(404, 'Character not found') + } + + throw error(500, 'Failed to load character') + } +} \ No newline at end of file diff --git a/src/routes/database/characters/[id]/+page.svelte b/src/routes/database/characters/[id]/+page.svelte new file mode 100644 index 00000000..ce84e3b3 --- /dev/null +++ b/src/routes/database/characters/[id]/+page.svelte @@ -0,0 +1,298 @@ + + + + +
+ + + {#if character} +
+
+
+ {getCharacterName(character.name)} { e.currentTarget.src = '/images/placeholders/placeholder-character-main.png' }} + /> +
+
+

{getCharacterName(character.name)}

+
+
+ Rarity: + {getRarityLabel(character.rarity)} +
+
+ Element: +
+ {#if character.element} + {getElementLabel(character.element)} + {getElementLabel(character.element)} + {:else} + + {/if} +
+
+
+ Max Level: + {character.max_level || '—'} +
+
+ Granblue ID: + {character.granblue_id || '—'} +
+
+
+
+ +
+

Details

+
+
+ Race: + {getRaceLabel(character.race)} +
+
+ Gender: + {getGenderLabel(character.gender)} +
+
+ Base HP: + {character.base_hp || '—'} +
+
+ Base Attack: + {character.base_attack || '—'} +
+
+ Max HP: + {character.max_hp || '—'} +
+
+ Max Attack: + {character.max_attack || '—'} +
+
+
+
+ {:else} +
+

Character Not Found

+

The character you're looking for could not be found.

+ +
+ {/if} +
+ + diff --git a/src/routes/database/summons/[id]/+page.server.ts b/src/routes/database/summons/[id]/+page.server.ts new file mode 100644 index 00000000..5442d308 --- /dev/null +++ b/src/routes/database/summons/[id]/+page.server.ts @@ -0,0 +1,25 @@ +import type { PageServerLoad } from './$types' +import { get } from '$lib/api/core' +import { error } from '@sveltejs/kit' + +export const load: PageServerLoad = async ({ params, fetch }) => { + try { + const summon = await get(fetch, `/summons/${params.id}`) + + if (!summon) { + throw error(404, 'Summon not found') + } + + return { + summon + } + } catch (err) { + console.error('Failed to load summon:', err) + + if (err instanceof Error && 'status' in err && err.status === 404) { + throw error(404, 'Summon not found') + } + + throw error(500, 'Failed to load summon') + } +} \ No newline at end of file diff --git a/src/routes/database/summons/[id]/+page.svelte b/src/routes/database/summons/[id]/+page.svelte new file mode 100644 index 00000000..c8a09ecd --- /dev/null +++ b/src/routes/database/summons/[id]/+page.svelte @@ -0,0 +1,379 @@ + + + + +
+ + + {#if summon} +
+
+
+ {getSummonName(summon.name)} { e.currentTarget.src = '/images/placeholders/placeholder-summon-main.png' }} + /> +
+
+

{getSummonName(summon.name)}

+
+
+ Rarity: + {getRarityLabel(summon.rarity)} +
+
+ Element: +
+ {#if summon.element} + {getElementLabel(summon.element)} + {getElementLabel(summon.element)} + {:else} + + {/if} +
+
+
+ Max Level: + {summon.max_level || '—'} +
+
+ Granblue ID: + {summon.granblue_id || '—'} +
+
+
+
+ +
+

Stats

+
+
+ Base HP: + {summon.base_hp || '—'} +
+
+ Base Attack: + {summon.base_attack || '—'} +
+
+ Max HP: + {summon.max_hp || '—'} +
+
+ Max Attack: + {summon.max_attack || '—'} +
+
+ Plus Bonus: + {summon.plus_bonus ? 'Yes' : 'No'} +
+
+ Series: + {summon.series || '—'} +
+
+
+ +
+

Call Effect

+
+ {#if summon.call_name || summon.call_description} +
+

{summon.call_name || 'Call Effect'}

+

+ {summon.call_description || 'No description available'} +

+
+ {:else} +

No call effect information available

+ {/if} +
+ +

Aura Effect

+
+ {#if summon.aura_name || summon.aura_description} +
+

{summon.aura_name || 'Aura Effect'}

+

+ {summon.aura_description || 'No description available'} +

+
+ {:else} +

No aura effect information available

+ {/if} +
+ + {#if summon.sub_aura_name || summon.sub_aura_description} +

Sub Aura Effect

+
+
+

{summon.sub_aura_name || 'Sub Aura Effect'}

+

+ {summon.sub_aura_description || 'No description available'} +

+
+
+ {/if} +
+
+ {:else} +
+

Summon Not Found

+

The summon you're looking for could not be found.

+ +
+ {/if} +
+ + diff --git a/src/routes/database/weapons/[id]/+page.server.ts b/src/routes/database/weapons/[id]/+page.server.ts new file mode 100644 index 00000000..ccf8eac9 --- /dev/null +++ b/src/routes/database/weapons/[id]/+page.server.ts @@ -0,0 +1,25 @@ +import type { PageServerLoad } from './$types' +import { get } from '$lib/api/core' +import { error } from '@sveltejs/kit' + +export const load: PageServerLoad = async ({ params, fetch }) => { + try { + const weapon = await get(fetch, `/weapons/${params.id}`) + + if (!weapon) { + throw error(404, 'Weapon not found') + } + + return { + weapon + } + } catch (err) { + console.error('Failed to load weapon:', err) + + if (err instanceof Error && 'status' in err && err.status === 404) { + throw error(404, 'Weapon not found') + } + + throw error(500, 'Failed to load weapon') + } +} \ No newline at end of file diff --git a/src/routes/database/weapons/[id]/+page.svelte b/src/routes/database/weapons/[id]/+page.svelte new file mode 100644 index 00000000..feb388dc --- /dev/null +++ b/src/routes/database/weapons/[id]/+page.svelte @@ -0,0 +1,369 @@ + + + + +
+ + + {#if weapon} +
+
+
+ {getWeaponName(weapon.name)} { e.currentTarget.src = '/images/placeholders/placeholder-weapon-main.png' }} + /> +
+
+

{getWeaponName(weapon.name)}

+
+
+ Rarity: + {getRarityLabel(weapon.rarity)} +
+
+ Element: +
+ {#if weapon.element} + {getElementLabel(weapon.element)} + {getElementLabel(weapon.element)} + {:else} + + {/if} +
+
+
+ Proficiency: +
+ {#if weapon.proficiency} + {getProficiencyLabel(weapon.proficiency)} + {getProficiencyLabel(weapon.proficiency)} + {:else} + + {/if} +
+
+
+ Max Level: + {weapon.max_level || '—'} +
+
+ Granblue ID: + {weapon.granblue_id || '—'} +
+
+
+
+ +
+

Stats

+
+
+ Base HP: + {weapon.base_hp || '—'} +
+
+ Base Attack: + {weapon.base_attack || '—'} +
+
+ Max HP: + {weapon.max_hp || '—'} +
+
+ Max Attack: + {weapon.max_attack || '—'} +
+
+ Skill Level Cap: + {weapon.skill_level_cap || '—'} +
+
+ Plus Bonus: + {weapon.plus_bonus ? 'Yes' : 'No'} +
+
+
+ +
+

Skills

+
+ {#if weapon.weapon_skills && weapon.weapon_skills.length > 0} + {#each weapon.weapon_skills as skill} +
+

{skill.name || 'Unknown Skill'}

+

{skill.description || 'No description available'}

+
+ {/each} + {:else} +

No skills available

+ {/if} +
+
+
+ {:else} +
+

Weapon Not Found

+

The weapon you're looking for could not be found.

+ +
+ {/if} +
+ + \ No newline at end of file