Skip to content

Commit de10eeb

Browse files
committed
updates
1 parent 1d3cacd commit de10eeb

24 files changed

+1200
-99
lines changed

packages/fws-obelix/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fy-/fws-obelix",
3-
"version": "0.0.36",
3+
"version": "0.0.54",
44
"description": "BB for FWS",
55
"author": "Florian 'Fy' Gasquez <m@fy.to>",
66
"license": "MIT",

packages/fws-obelix/src/components/BBHome.vue

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
useRest,
77
useSeo,
88
useTranslation,
9+
DefaultPaging,
910
} from "@fy-/fws-vue";
1011
import { useRoute } from "vue-router";
1112
import BBPost from "./BBPost.vue";
@@ -33,19 +34,27 @@ const eventBus = useEventBus();
3334
const posts = ref();
3435
const order = useLocalStorage("bb_order", "t");
3536
const is404 = ref(false);
36-
async function getPosts() {
37+
const paging = ref();
38+
async function getPosts(page = 1) {
3739
eventBus.emit("main-loading", true);
3840
is404.value = false;
41+
if (route.query.page) page = Number.parseInt(route.query.page as string);
42+
3943
if (!props.isSingle && route.params.uuid) {
4044
const data = await rest(
4145
`ObelixBB/${route.params.uuid.toString()}/${order.value}`,
4246
"GET",
47+
{
48+
results_per_page: 15,
49+
page_no: page,
50+
},
4351
).catch(() => {
4452
is404.value = true;
4553
eventBus.emit("main-loading", false);
4654
});
4755
if (data && data.result === "success") {
4856
posts.value = data.data;
57+
paging.value = data.paging;
4958
} else {
5059
is404.value = true;
5160
}
@@ -75,9 +84,11 @@ onMounted(() => {
7584
mounted.value = true;
7685
}
7786
eventBus.on("reloadBB", getPosts);
87+
eventBus.on("bbpostsGoToPage", getPosts);
7888
});
7989
onUnmounted(() => {
8090
eventBus.off("reloadBB", getPosts);
91+
eventBus.off("bbpostsGoToPage", getPosts);
8192
});
8293
8394
watch(
@@ -236,6 +247,12 @@ const nav = computed(() => {
236247
>
237248
{{ $t("bb_new_post_cta") }}
238249
</router-link>
250+
<DefaultPaging
251+
v-if="paging"
252+
id="bbposts"
253+
:items="paging"
254+
:show-legend="false"
255+
/>
239256
</div>
240257
<BBPost
241258
v-for="post in posts.Posts"
@@ -246,6 +263,9 @@ const nav = computed(() => {
246263
:img-domain="imgDomain"
247264
/>
248265
</div>
266+
<div class="flex items-center justify-end mt-2">
267+
<DefaultPaging v-if="paging" id="bbposts" :items="paging" />
268+
</div>
249269
</div>
250270
</template>
251271
</template>

packages/fws-obelix/src/components/BBPost.vue

Lines changed: 89 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ import {
1111
EyeIcon,
1212
EllipsisVerticalIcon,
1313
PaperClipIcon,
14+
HeartIcon,
1415
} from "@heroicons/vue/24/solid";
1516
import BBReply from "./BBReply.vue";
16-
import BBReplies from "./BBReplies.vue";
17+
import BBRepliesClassic from "./BBRepliesClassic.vue";
18+
import RepliesClassic from "./RepliesClassic.vue";
1719
import { useBBStore } from "./bbStore";
1820
1921
const md = markdownit();
@@ -115,7 +117,12 @@ watch(isAuth, () => {
115117
});
116118
onMounted(() => {
117119
mounted.value = true;
118-
if (isAuth.value && props.isSingle) {
120+
if (
121+
isAuth.value &&
122+
props.isSingle &&
123+
userMenu.value &&
124+
userMenuButton.value
125+
) {
119126
useMenuInstance.value = new Dropdown(userMenu.value, userMenuButton.value, {
120127
offsetDistance: -5,
121128
});
@@ -129,8 +136,10 @@ onMounted(() => {
129136
:to="isSingle ? undefined : `/forums/${$route.params.uuid}/${post.Slug}`"
130137
class="gap-1 bb-container-base !rounded-none block"
131138
:itemid="`/forums/${$route.params.uuid}/${post.Slug}`"
132-
itemscope
133-
itemtype="https://schema.org/DiscussionForumPosting"
139+
:itemscope="isSingle ? true : undefined"
140+
:itemtype="
141+
isSingle ? 'https://schema.org/DiscussionForumPosting' : undefined
142+
"
134143
:class="{
135144
'!border-b-0': !isSingle && idx !== total,
136145
'bb-data': !isSingle,
@@ -319,7 +328,7 @@ onMounted(() => {
319328
}}
320329
</div>
321330
<div class="flex gap-2 lg:w-full justify-start items-center">
322-
<ChatBubbleLeftRightIcon class="w-4 h-4" />
331+
<HeartIcon class="w-4 h-4" />
323332
{{ $t("bb_user_likes", { count: post.User.ForumsLikesCount }) }}
324333
</div>
325334
<div class="flex gap-2 lg:w-full justify-start items-center">
@@ -486,24 +495,63 @@ onMounted(() => {
486495
</span>
487496
</div>
488497
</RouterLink>
498+
<div>•</div>
499+
<div itemprop="datePublished">
500+
<time :datetime="post.CreatedAt.iso">{{
501+
$formatDate(post.CreatedAt.iso)
502+
}}</time>
503+
</div>
489504
</div>
490505
</div>
491506
</div>
492-
<h2 class="h3 px-1 mt-5">
493-
{{
494-
$t("bb_comment", {
495-
count: post.ReplyCount ? post.ReplyCount : 0,
496-
})
497-
}}
498-
</h2>
499-
<div v-if="isSingle" class="px-2 bb-data !rounded-none mt-3">
500-
<BBReply v-if="isSingle" :post="post" :posts="posts" />
501507

502-
<BBReplies :post="post" />
508+
<div id="replies">
509+
<BBRepliesClassic
510+
v-if="isSingle"
511+
:post="post"
512+
:posts="posts"
513+
:rank-component="rankComponent"
514+
:avatar-component="avatarComponent"
515+
/>
516+
</div>
517+
<!--
518+
<div v-if="isSingle" class="px-2 bb-data !rounded-none mt-3">
519+
<BBReplies :post="post" />
503520
</div>
521+
-->
504522
</template>
505523
<template v-else>
506-
<div class="flex gap-2 items-center py-1.5">
524+
<article
525+
class="flex gap-2 items-center py-1.5"
526+
itemtype="https://schema.org/DiscussionForumPosting"
527+
itemscope
528+
>
529+
<meta
530+
itemprop="url"
531+
:content="`/forums/${$route.params.uuid}/${post.Slug}`"
532+
/>
533+
<meta itemprop="headline" :content="post.Title" />
534+
<meta
535+
v-if="post.PostType === 3"
536+
itemprop="image"
537+
:content="post.LinkData"
538+
/>
539+
<meta
540+
v-else-if="post.LinkType === 'yt'"
541+
itemprop="video"
542+
:content="`https://www.youtube.com/embed/${post.LinkData}`"
543+
/>
544+
<meta v-else itemprop="articleBody" :content="post.Message" />
545+
<meta itemprop="datePublished" :content="post.CreatedAt.iso" />
546+
<div
547+
class="absolute opacity-0 w-0 h-0 overflow-hidden"
548+
itemprop="author"
549+
itemscope
550+
itemtype="https://schema.org/Person"
551+
>
552+
<meta itemprop="name" :content="post.User.UserProfile.Username" />
553+
</div>
554+
507555
<div class="flex items-center justify-center pl-3 pr-1">
508556
<component
509557
:is="avatarComponent"
@@ -528,7 +576,7 @@ onMounted(() => {
528576
'h3 gap-2 items-center flex ': !isSingle,
529577
}"
530578
>
531-
<span itemprop="headline">{{ post.Title }}</span>
579+
<span>{{ post.Title }}</span>
532580

533581
<div class="hidden lg:flex items-center gap-1">
534582
<span
@@ -578,21 +626,16 @@ onMounted(() => {
578626
<div class="mt-0">
579627
<div class="text-white/[.5] text-xs">
580628
Posted by
581-
<span
582-
itemprop="author"
583-
itemscope
584-
itemtype="https://schema.org/Person"
585-
>
586-
<b itemprop="name"
587-
>@{{
588-
post.User?.UserProfile?.Username
589-
? post.User.UserProfile.Username
590-
: "Anonymous"
591-
}}</b
592-
>
629+
<span itemtype="https://schema.org/Person" itemprop="author">
630+
<b itemprop="name">{{
631+
post.User?.UserProfile?.Username
632+
? post.User.UserProfile.Username
633+
: "Anonymous"
634+
}}</b>
593635
</span>
636+
594637
on
595-
<time itemprop="datePublished" :datetime="post.CreatedAt.iso">{{
638+
<time :datetime="post.CreatedAt.iso">{{
596639
$formatDate(post.CreatedAt.iso)
597640
}}</time
598641
>.
@@ -715,14 +758,21 @@ onMounted(() => {
715758
</div>
716759
</RouterLink>
717760
</div>
718-
<div class="hidden lg:flex gap-4 items-center pr-3 w-44">
761+
<div
762+
class="hidden lg:flex gap-4 items-center justify-between pr-3 w-44"
763+
>
719764
<div v-if="post.LastReplyID" class="text-sm">
720-
{{ $formatTimeago(post.LastReply.CreatedAt.unixms) }}<br />
721-
@{{
722-
post.LastReply.User?.UserProfile?.Username
723-
? post.LastReply.User.UserProfile.Username
724-
: "Anonymous"
725-
}}
765+
<span itemprop="dateModified">
766+
{{ $formatTimeago(post.LastReply.CreatedAt.unixms) }}
767+
</span>
768+
<br />
769+
<span>
770+
@{{
771+
post.LastReply.User?.UserProfile?.Username
772+
? post.LastReply.User.UserProfile.Username
773+
: "Anonymous"
774+
}}</span
775+
>
726776
</div>
727777
<component
728778
:is="avatarComponent"
@@ -733,8 +783,7 @@ onMounted(() => {
733783
: post.LastReply.User.UUID
734784
"
735785
:user="post.LastReply.User"
736-
class="w-10 h-10"
737-
cls="w-10 h-10"
786+
class="w-10 h-10 shrink-0 grow-0"
738787
/>
739788
<div
740789
v-if="!post.LastReplyID"
@@ -743,7 +792,7 @@ onMounted(() => {
743792
n/a
744793
</div>
745794
</div>
746-
</div>
795+
</article>
747796
</template>
748797
</component>
749798
</template>

packages/fws-obelix/src/components/BBReplies.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ onUnmounted(() => {
8383
/>
8484
<div class="text-fv-neutral-500 text-xs mb-1">
8585
<span class="text-fv-neutral-400">
86-
<b itemprop="author">@{{ reply.User.Username }}</b>
86+
<b itemprop="author">@{{ reply.User.UserProfile.Username }}</b>
8787
</span>
8888
on
8989
<time itemprop="dateCreated" :datetime="reply.CreatedAt.iso">{{

0 commit comments

Comments
 (0)