feat: refactor play area into sidebar layout with buttplug, recordings, and leaderboard sub-pages
- Add /play sidebar layout (mobile nav + desktop sidebar) with SexyBackground - Move buttplug device control to /play/buttplug with Empty component and scan button - Move recordings from /me/recordings to /play/recordings - Move leaderboard to /play/leaderboard; redirect /leaderboard → /play/leaderboard - Redirect /me/recordings → /play/recordings and /play → /play/buttplug - Remove recordings entry from /me sidebar nav - Rename "SexyPlay" → "Play", swap bluetooth icon for rocket, remove subtitle - Add play.nav i18n keys (play, recordings, leaderboard, back_to_site, back_mobile) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
import type { PageServerLoad } from "./$types";
|
||||
import { gql } from "graphql-request";
|
||||
import { getGraphQLClient } from "$lib/api";
|
||||
|
||||
const LEADERBOARD_QUERY = gql`
|
||||
query Leaderboard($limit: Int, $offset: Int) {
|
||||
leaderboard(limit: $limit, offset: $offset) {
|
||||
user_id
|
||||
display_name
|
||||
avatar
|
||||
total_weighted_points
|
||||
total_raw_points
|
||||
recordings_count
|
||||
playbacks_count
|
||||
achievements_count
|
||||
rank
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const load: PageServerLoad = async ({ fetch, url }) => {
|
||||
try {
|
||||
const limit = parseInt(url.searchParams.get("limit") || "100");
|
||||
const offset = parseInt(url.searchParams.get("offset") || "0");
|
||||
|
||||
const client = getGraphQLClient(fetch);
|
||||
const data = await client.request<{
|
||||
leaderboard: {
|
||||
user_id: string;
|
||||
display_name: string | null;
|
||||
avatar: string | null;
|
||||
total_weighted_points: number | null;
|
||||
total_raw_points: number | null;
|
||||
recordings_count: number | null;
|
||||
playbacks_count: number | null;
|
||||
achievements_count: number | null;
|
||||
rank: number;
|
||||
}[];
|
||||
}>(LEADERBOARD_QUERY, { limit, offset });
|
||||
|
||||
return {
|
||||
leaderboard: data.leaderboard || [],
|
||||
pagination: {
|
||||
limit,
|
||||
offset,
|
||||
hasMore: data.leaderboard?.length === limit,
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Leaderboard load error:", error);
|
||||
return {
|
||||
leaderboard: [],
|
||||
pagination: {
|
||||
limit: 100,
|
||||
offset: 0,
|
||||
hasMore: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user