parent
b7d61fa03e
commit
1dc349a246
src
@ -37,8 +37,12 @@ export const getUserPosts = async (did: string, count: number = 10, cursor: stri
|
||||
const lastPosts = writable<Post[]>([])
|
||||
|
||||
export const updateLastPosts = async () => {
|
||||
const { posts } = await getUserPosts("did:plc:dfl62fgb7wtjj3fcbb72naae", 13)
|
||||
lastPosts.set(posts)
|
||||
try {
|
||||
const { posts } = await getUserPosts("did:plc:dfl62fgb7wtjj3fcbb72naae", 13)
|
||||
lastPosts.set(posts)
|
||||
} catch (err) {
|
||||
console.log(`can't update last posts ${err}`)
|
||||
}
|
||||
}
|
||||
|
||||
export const getLastPosts = () => { return get(lastPosts) }
|
@ -8,6 +8,7 @@ type LastTrack = {
|
||||
image: string | null,
|
||||
link: string,
|
||||
when: number,
|
||||
playing: boolean,
|
||||
}
|
||||
const lastTrack = writable<LastTrack | null>(null)
|
||||
|
||||
@ -24,10 +25,12 @@ export const lastFmUpdateNowPlaying = async () => {
|
||||
image: track.image[2]['#text'] ?? null,
|
||||
link: track.url,
|
||||
when: Date.now(),
|
||||
playing: true,
|
||||
}
|
||||
lastTrack.set(data)
|
||||
} catch(why) {
|
||||
console.log("could not fetch last fm: ", why)
|
||||
lastTrack.update((t) => { if (t !== null) { t.playing = false; } return t })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ type LastGame = {
|
||||
icon: string,
|
||||
pfp: string,
|
||||
when: number,
|
||||
playing: boolean,
|
||||
}
|
||||
|
||||
const steamgriddbClient = writable<SGDB | null>(null)
|
||||
@ -35,10 +36,12 @@ export const steamUpdateNowPlaying = async () => {
|
||||
icon: icons[0].thumb.toString(),
|
||||
pfp: profile.avatarmedium,
|
||||
when: Date.now(),
|
||||
playing: true,
|
||||
}
|
||||
lastGame.set(game)
|
||||
} catch(why) {
|
||||
console.log("could not fetch steam: ", why)
|
||||
lastGame.update((t) => { if (t !== null) { t.playing = false; } return t })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@
|
||||
<p
|
||||
class="text-shadow-green text-ralsei-green-light text-sm text-ellipsis text-nowrap overflow-hidden max-w-[30ch]"
|
||||
>
|
||||
<span class="text-sm text-shadow-white text-ralsei-white">listening to</span>
|
||||
<span class="text-sm text-shadow-white text-ralsei-white">{data.lastTrack.playing ? "listening to" : "listened to"}</span>
|
||||
<a
|
||||
title={data.lastTrack.name}
|
||||
href="https://www.last.fm/user/yusdacra"
|
||||
@ -212,7 +212,7 @@
|
||||
<p
|
||||
class="text-shadow-green text-ralsei-green-light text-sm text-ellipsis text-nowrap overflow-hidden max-w-[30ch]"
|
||||
>
|
||||
<span class="text-sm text-shadow-white text-ralsei-white">playing</span>
|
||||
<span class="text-sm text-shadow-white text-ralsei-white">{data.lastGame.playing ? "playing" : "played"}</span>
|
||||
<a title={data.lastGame.name} class="hover:underline" href={data.lastGame.link}
|
||||
>{data.lastGame.name}</a
|
||||
>
|
||||
|
Loading…
x
Reference in New Issue
Block a user