improve SEO on UGC, proxy S3

This commit is contained in:
Face 2025-06-28 17:31:05 +03:00
parent 6e4e8a4eaa
commit 107c78a5f2
13 changed files with 149 additions and 34 deletions

View file

@ -0,0 +1,27 @@
import { error } from '@sveltejs/kit';
export async function load({ params, fetch }) {
const { username } = params;
try {
const response = await fetch(`/api/user/${username}`);
if (!response.ok) {
if (response.status === 404) {
throw error(404, 'User not found');
}
throw error(500, 'Failed to load user profile');
}
const profileData = await response.json();
return {
username,
profileData,
recentTransactions: profileData.recentTransactions || []
};
} catch (e) {
console.error('Failed to fetch user profile:', e);
throw error(500, 'Failed to load user profile');
}
}

View file

@ -20,15 +20,14 @@
Activity
} from 'lucide-svelte';
import { goto } from '$app/navigation';
import type { UserProfileData } from '$lib/types/user-profile';
import { USER_DATA } from '$lib/stores/user-data';
let { data } = $props();
let username = $derived(data.username);
let profileData = $state<UserProfileData | null>(null);
let recentTransactions = $state<any[]>([]);
let loading = $state(true);
let profileData = $state(data.profileData);
let recentTransactions = $state(data.recentTransactions);
let loading = $state(false);
let previousUsername = $state<string | null>(null);
@ -37,8 +36,11 @@
);
onMount(async () => {
await fetchProfileData();
previousUsername = username;
if (isOwnProfile) {
await fetchTransactions();
}
});
$effect(() => {
@ -350,7 +352,7 @@
? `${profileData.profile.bio} - View ${profileData.profile.name}'s simulated trading activity and virtual portfolio in the Rugplay cryptocurrency simulation game.`
: `View @${username}'s profile and simulated trading activity in Rugplay - cryptocurrency trading simulation game platform.`}
type="profile"
image={profileData?.profile?.image ? getPublicUrl(profileData.profile.image) : '/rugplay.svg'}
image={profileData?.profile?.image ? getPublicUrl(profileData.profile.image) : '/apple-touch-icon.png'}
imageAlt={profileData?.profile?.name
? `${profileData.profile.name}'s profile picture`
: `@${username}'s profile`}

View file

@ -1,5 +0,0 @@
export async function load({ params }) {
return {
username: params.username
};
}