Skip to content

Commit c448d6e

Browse files
committed
refactor: adjust appview/frontend to lexicon changes.
1 parent 15b7fbe commit c448d6e

File tree

8 files changed

+45
-22
lines changed

8 files changed

+45
-22
lines changed

PinkSea.Frontend/src/api/atproto/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const getRecordKeyFromAtUri = (uri: string) => {
1414

1515
export const buildOekakiUrlFromOekakiObject = (oekaki: Oekaki) => {
1616
const rkey = getRecordKeyFromAtUri(oekaki.at)
17-
return `/${oekaki.did}/oekaki/${rkey}`
17+
return `/${oekaki.author.did}/oekaki/${rkey}`
1818
}
1919

2020
export const formatDate = (date: Date) => {

PinkSea.Frontend/src/components/TimeLineOekakiCard.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const props = defineProps<{
1414
}>()
1515
1616
const imageLink = computed(() => `url(${props.oekaki.image})`)
17-
const authorProfileLink = computed(() => `/${props.oekaki.did}`);
17+
const authorProfileLink = computed(() => `/${props.oekaki.author.did}`);
1818
const creationTime = computed(() => {
1919
return formatDate(props.oekaki.creationTime)
2020
})
@@ -37,7 +37,7 @@ const openInNewTab = () => {
3737
<div class="oekaki-nsfw-blur" v-if="props.oekaki.nsfw && persistedStore.blurNsfw">NSFW</div>
3838
</div>
3939
<div class="oekaki-meta">
40-
<span>{{ $t("timeline.by_before_handle") }}<b class="oekaki-author"> <RouterLink :to="authorProfileLink" >@{{ props.oekaki.handle }}</RouterLink></b>{{ $t("timeline.by_after_handle") }}</span><br>
40+
<span>{{ $t("timeline.by_before_handle") }}<b class="oekaki-author"> <RouterLink :to="authorProfileLink" >@{{ props.oekaki.author.handle }}</RouterLink></b>{{ $t("timeline.by_after_handle") }}</span><br>
4141
<span>{{ creationTime }}</span><br>
4242
<TagContainer v-if="props.oekaki.tags !== undefined && props.oekaki.tags.length > 0" :tags="props.oekaki.tags" />
4343
<div class="oekaki-tag-container-substitute" v-else>.</div>

PinkSea.Frontend/src/components/oekaki/PostViewOekakiChildCard.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const props = defineProps<{
1515
const router = useRouter();
1616
const persistedStore = usePersistedStore();
1717
18-
const authorProfileLink = computed(() => `/${props.oekaki.did}`);
18+
const authorProfileLink = computed(() => `/${props.oekaki.author.did}`);
1919
const creationTime = computed(() => {
2020
return formatDate(props.oekaki.creationTime)
2121
})
@@ -30,18 +30,18 @@ const redirectToParent = async () => {
3030
const rkey = getRecordKeyFromAtUri(props.oekaki.at);
3131
const { data } = await xrpc.get("com.shinolabs.pinksea.getParentForReply", {
3232
params: {
33-
did: props.oekaki.did,
33+
did: props.oekaki.author.did,
3434
rkey: rkey!
3535
}
3636
});
3737
38-
await router.push(`/${data.did}/oekaki/${data.rkey}#${props.oekaki.did}-${rkey}`);
38+
await router.push(`/${data.did}/oekaki/${data.rkey}#${props.oekaki.author.did}-${rkey}`);
3939
};
4040
</script>
4141

4242
<template>
4343
<div :class="classList" v-if="!props.oekaki.nsfw || (props.oekaki.nsfw && !persistedStore.hideNsfw)">
44-
<div class="oekaki-child-info">{{ $t("post.response_from_before_handle") }}<b class="oekaki-author"> <RouterLink :to="authorProfileLink" >@{{ props.oekaki.handle }}</RouterLink></b>{{ $t("post.response_from_after_handle") }}{{ $t("post.response_from_at_date") }}{{ creationTime }}</div>
44+
<div class="oekaki-child-info">{{ $t("post.response_from_before_handle") }}<b class="oekaki-author"> <RouterLink :to="authorProfileLink" >@{{ props.oekaki.author.handle }}</RouterLink></b>{{ $t("post.response_from_after_handle") }}{{ $t("post.response_from_at_date") }}{{ creationTime }}</div>
4545
<PostViewOekakiImageContainer :oekaki="props.oekaki" v-on:click="redirectToParent" style="max-height: 400px; cursor: pointer;"/>
4646
</div>
4747
</template>

PinkSea.Frontend/src/components/oekaki/PostViewOekakiParentCard.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const props = defineProps<{
1212
1313
const persistedStore = usePersistedStore();
1414
15-
const authorProfileLink = computed(() => `/${props.oekaki.did}`);
15+
const authorProfileLink = computed(() => `/${props.oekaki.author.did}`);
1616
const creationTime = computed(() => {
1717
return formatDate(props.oekaki.creationTime)
1818
})
@@ -23,7 +23,7 @@ const creationTime = computed(() => {
2323
<div class="oekaki-card" v-if="!props.oekaki.nsfw || (props.oekaki.nsfw && !persistedStore.hideNsfw)">
2424
<PostViewOekakiImageContainer :oekaki="props.oekaki" />
2525
<div class="oekaki-meta">
26-
<span>{{ $t("timeline.by_before_handle" )}}<b class="oekaki-author"> <RouterLink :to="authorProfileLink" >@{{ props.oekaki.handle }}</RouterLink></b>{{ $t("timeline.by_after_handle" )}}</span><br>
26+
<span>{{ $t("timeline.by_before_handle" )}}<b class="oekaki-author"> <RouterLink :to="authorProfileLink" >@{{ props.oekaki.author.handle }}</RouterLink></b>{{ $t("timeline.by_after_handle" )}}</span><br>
2727
<span>{{ creationTime }}</span><br>
2828
<TagContainer v-if="props.oekaki.tags !== undefined" :tags="props.oekaki.tags" />
2929
</div>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export interface Author {
2+
did: string,
3+
handle: string
4+
}

PinkSea.Frontend/src/models/oekaki.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import type { Author } from '@/models/author'
2+
13
export interface Oekaki {
2-
did: string,
3-
handle: string,
4+
author: Author,
45
image: string,
56
at: string,
67
cid: string,

PinkSea/Lexicons/Objects/Author.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace PinkSea.Lexicons.Objects;
4+
5+
/// <summary>
6+
/// The "com.shinolabs.pinksea.appViewDefs#author" object.
7+
/// </summary>
8+
public class Author
9+
{
10+
/// <summary>
11+
/// The DID of the author.
12+
/// </summary>
13+
[JsonPropertyName("did")]
14+
public required string Did { get; set; }
15+
16+
/// <summary>
17+
/// The handle of the author.
18+
/// </summary>
19+
[JsonPropertyName("handle")]
20+
public required string Handle { get; set; }
21+
}

PinkSea/Lexicons/Objects/HydratedOekaki.cs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,10 @@ namespace PinkSea.Lexicons.Objects;
99
public class HydratedOekaki
1010
{
1111
/// <summary>
12-
/// The DID of the author.
12+
/// The author of the oekaki.
1313
/// </summary>
14-
[JsonPropertyName("did")]
15-
public required string Did { get; set; }
16-
17-
/// <summary>
18-
/// The handle of the author.
19-
/// </summary>
20-
[JsonPropertyName("handle")]
21-
public required string Handle { get; set; }
14+
[JsonPropertyName("author")]
15+
public required Author Author { get; set; }
2216

2317
/// <summary>
2418
/// The image link.
@@ -73,8 +67,11 @@ public static HydratedOekaki FromOekakiModel(
7367
{
7468
return new HydratedOekaki
7569
{
76-
Did = oekakiModel.AuthorDid,
77-
Handle = authorHandle,
70+
Author = new Author
71+
{
72+
Did = oekakiModel.AuthorDid,
73+
Handle = authorHandle
74+
},
7875
CreationTime = oekakiModel.IndexedAt,
7976
ImageLink =
8077
$"https://cdn.bsky.app/img/feed_fullsize/plain/{oekakiModel.AuthorDid}/{oekakiModel.BlobCid}",

0 commit comments

Comments
 (0)