minor improvement
This commit is contained in:
parent
c1831b650d
commit
1aaa9db229
|
@ -19,6 +19,8 @@ export default function Dashboard() {
|
||||||
const { links } = useLinkStore();
|
const { links } = useLinkStore();
|
||||||
const { tags } = useTagStore();
|
const { tags } = useTagStore();
|
||||||
|
|
||||||
|
const [numberOfLinks, setNumberOfLinks] = useState(0);
|
||||||
|
|
||||||
const [tagPinDisclosure, setTagPinDisclosure] = useState<boolean>(() => {
|
const [tagPinDisclosure, setTagPinDisclosure] = useState<boolean>(() => {
|
||||||
const storedValue = localStorage.getItem("tagPinDisclosure");
|
const storedValue = localStorage.getItem("tagPinDisclosure");
|
||||||
return storedValue ? storedValue === "true" : true;
|
return storedValue ? storedValue === "true" : true;
|
||||||
|
@ -37,6 +39,15 @@ export default function Dashboard() {
|
||||||
|
|
||||||
useLinks({ pinnedOnly: true, sort: 0 });
|
useLinks({ pinnedOnly: true, sort: 0 });
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setNumberOfLinks(
|
||||||
|
collections.reduce(
|
||||||
|
(accumulator, collection) => accumulator + collection._count.links,
|
||||||
|
0
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}, [collections]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
"tagPinDisclosure",
|
"tagPinDisclosure",
|
||||||
|
@ -74,18 +85,15 @@ export default function Dashboard() {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
<div className="flex flex-col md:flex-row md:items-center justify-evenly gap-2 mb-10">
|
<div className="flex flex-col md:flex-row md:items-center justify-evenly gap-2 mb-10">
|
||||||
<div className="flex items-baseline gap-2">
|
<div className="flex items-baseline gap-2">
|
||||||
<p className="font-bold text-6xl bg-gradient-to-tr from-sky-500 to-slate-400 bg-clip-text text-transparent">
|
<p className="font-bold text-6xl bg-gradient-to-tr from-sky-500 to-slate-400 bg-clip-text text-transparent">
|
||||||
{collections.reduce(
|
{numberOfLinks}
|
||||||
(accumulator, collection) =>
|
|
||||||
accumulator + collection._count.links,
|
|
||||||
0
|
|
||||||
)}
|
|
||||||
</p>
|
</p>
|
||||||
<p className="text-sky-900 text-xl">
|
<p className="text-sky-900 text-xl">
|
||||||
Links
|
{numberOfLinks === 1 ? "Link" : "Links"}
|
||||||
{/* {links.length == 1 ? "Links" : "Link"} */}
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Ŝarĝante…
Reference in New Issue