@@ -3,8 +3,9 @@ import SignInGate from '@/components/SignInGate.vue';
3
3
import { getRing , getRingsUserIsAMemberOf } from ' @/lib/atproto/atweb-unauthed' ;
4
4
import { resolveHandleAnonymously } from ' @/lib/atproto/handles/resolve' ;
5
5
import { getDidAndPds } from ' @/lib/atproto/pds-helpers' ;
6
+ import { rkeyToFilepath } from ' @/lib/atproto/rkey' ;
6
7
import { user , type User } from ' @/lib/atproto/signed-in-user' ;
7
- import { watchImmediateAsync } from ' @/lib/vue-utils' ;
8
+ import { resolveRoute , watchImmediateAsync } from ' @/lib/vue-utils' ;
8
9
import router from ' @/router' ;
9
10
import type { IoGithubAtwebRing } from ' @atcute/client/lexicons' ;
10
11
import { now as tidNow } from ' @atcute/tid' ;
@@ -17,9 +18,9 @@ import { useModal } from 'vuestic-ui';
17
18
18
19
type Ring = Awaited <ReturnType <typeof getRing >>;
19
20
20
- const rings = ref <Ring []>();
21
+ const rings = ref <( Ring & { mainPage : AtUri }) []>();
21
22
const route = useRoute (' /rings' );
22
- const selectedRing = ref <Ring >();
23
+ const selectedRing = ref <( Ring & { mainPage : AtUri }) >();
23
24
24
25
await watchImmediateAsync (
25
26
[route , user ],
@@ -190,6 +191,19 @@ function copyRingMdx(ring: Ring) {
190
191
` <RingLink direction="next" ring-uri="${ring .uri .toString ()}" self="${user .value ! .did }">next</RingLink> `
191
192
);
192
193
}
194
+
195
+ const mainPageLink = ref (' ' );
196
+ watch (selectedRing , selectedRing => {
197
+ if (! selectedRing ) return ;
198
+ mainPageLink .value = rkeyToFilepath (selectedRing .mainPage .rkey );
199
+ });
200
+
201
+ async function setMainPage(ring : (Ring & { mainPage: AtUri }), mainPageLink : string ) {
202
+ user .value ! .client .setMainPage (
203
+ ring .members .find (e => e .membership .host === user .value ! .did )! .membership .rkey ,
204
+ mainPageLink
205
+ );
206
+ }
193
207
</script >
194
208
195
209
<template >
@@ -266,7 +280,14 @@ function copyRingMdx(ring: Ring) {
266
280
<p ><b >{{ selectedRing.members?.length ?? 0 }}</b > member(s)</p >
267
281
<p >Managed by <a class =" va-link" :href =" `https://bsky.app/profile/${selectedRing.uri.host}`" >@{{ getMemberName(selectedRing.uri) }}</a ></p >
268
282
269
- <VaButton @click =" copyRingMdx(selectedRing)" >Copy ring MDX code</VaButton >
283
+ <div class =" va-gutter-2" >
284
+ <VaButton @click =" copyRingMdx(selectedRing)" >Copy ring MDX code</VaButton >
285
+ </div >
286
+
287
+ <div class =" va-gutter-2" >
288
+ <VaInput v-model =" mainPageLink" label =" My main page" ></VaInput >
289
+ <VaButton @click =" setMainPage(selectedRing, mainPageLink)" class =" set-my-main-page-button" >Set my main page</VaButton >
290
+ </div >
270
291
271
292
<div v-for =" member in selectedRing.members" :key =" member.membership.toString()" class =" ring-member-card va-gutter-2" >
272
293
<div class =" va-gutter-2" >
@@ -318,6 +339,10 @@ function copyRingMdx(ring: Ring) {
318
339
.ring-member-card :deep(.bluesky-embed ) {
319
340
margin : 0 ;
320
341
}
342
+ .set-my-main-page-button {
343
+ margin-left : 0.1rem ;
344
+ vertical-align : text-top ;
345
+ }
321
346
</style >
322
347
323
348
<style lang="scss">
0 commit comments