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