11<template >
22 <div id =" social-wall-container" >
3- <div class =" flex justify-center mb-6 space-x-4" >
3+ <div
4+ class =" flex justify-center mb-6 space-x-4"
5+ role =" tablist"
6+ aria-label =" Social wall filters"
7+ >
48 <button
5- :class =" ['tab', { 'tab-active': !filterType }]"
9+ :class =" tabClasses(null)"
10+ role =" tab"
11+ :aria-selected =" !filterType"
612 @click =" filterMessages(null)"
13+ type =" button"
714 >
815 {{ t("All Messages") }}
916 </button >
1017 <button
11- :class =" ['tab', { 'tab-active': filterType === 'promoted' }]"
18+ :class =" tabClasses('promoted')"
19+ role =" tab"
20+ :aria-selected =" filterType === 'promoted'"
1221 @click =" filterMessages('promoted')"
22+ type =" button"
1323 >
1424 {{ t("Promoted Messages") }}
1525 </button >
@@ -55,8 +65,8 @@ const isAdmin = securityStore.isAdmin
5565watch (
5666 () => route .query .filterType ,
5767 (newFilterType ) => {
58- filterType .value = newFilterType
59- refreshPosts ()
68+ filterType .value = newFilterType || null
69+ postListRef . value ? . refreshPosts ()
6070 },
6171)
6272
@@ -73,4 +83,15 @@ function filterMessages(type) {
7383 router .push ({ path: " /social" , query: { filterType: type } })
7484 }
7585}
86+
87+ function tabClasses (type ) {
88+ const isActive = type ? filterType .value === type : ! filterType .value
89+ return [
90+ " inline-flex items-center rounded-full border px-4 py-2 text-body-2 font-medium transition-colors duration-150" ,
91+ " focus:outline-none focus:ring-2 focus:ring-primary" ,
92+ isActive
93+ ? " bg-primary border-primary text-white shadow-sm hover:bg-primary/90"
94+ : " bg-white border-gray-25 text-gray-90 hover:bg-gray-15" ,
95+ ]
96+ }
7697< / script>
0 commit comments