Exosphere is a set of small, modular, self-hostable community tools built on the AT Protocol. app.exosphere.site
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: improved ssr

Hugo 8c41ca05 ed1dbf16

+37 -44
-4
packages/app/test-results/.last-run.json
··· 1 - { 2 - "status": "passed", 3 - "failedTests": [] 4 - }
+13 -14
packages/feature-requests/src/ui/pages/feature-request.tsx
··· 2 2 import { auth } from "@exosphere/client/auth"; 3 3 import { useLocation, useRoute, spherePath } from "@exosphere/client/router"; 4 4 import { Link } from "@exosphere/client/link"; 5 - import { useCanDo } from "@exosphere/client/permissions"; 5 + import { canDo } from "@exosphere/client/permissions"; 6 6 import { useQuery } from "@exosphere/client/hooks"; 7 7 import * as ui from "@exosphere/client/ui.css"; 8 8 import * as frUi from "../ui.css.ts"; ··· 564 564 } 565 565 }, [votesQuery.data]); 566 566 567 - const canComment = useCanDo("feature-requests", "comment"); 568 - const canModerate = useCanDo("feature-requests", "moderate"); 569 - const canChangeStatus = useCanDo("feature-requests", "changeStatus"); 570 - const canMarkDuplicate = useCanDo("feature-requests", "markDuplicate"); 567 + const canComment = canDo("feature-requests", "comment"); 568 + const canModerate = canDo("feature-requests", "moderate"); 569 + const canChangeStatus = canDo("feature-requests", "changeStatus"); 570 + const canMarkDuplicate = canDo("feature-requests", "markDuplicate"); 571 571 572 572 const availableLabels = useSignal<LabelData[]>([]); 573 573 const localLabelIds = useSignal<string[] | null>(null); ··· 575 575 576 576 const fr = data?.featureRequest; 577 577 const isAuthor = currentDid != null && currentDid === fr?.authorDid; 578 - const canEditLabels = canChangeStatus.value || isAuthor; 578 + const canEditLabels = canChangeStatus || isAuthor; 579 579 580 580 useEffect(() => { 581 581 if (canEditLabels) { ··· 689 689 onVote={toggleVote} 690 690 onUnvote={toggleVote} 691 691 statusSlot={ 692 - canChangeStatus.value || currentDid === fr.authorDid || canModerate.value ? ( 692 + canChangeStatus || currentDid === fr.authorDid || canModerate ? ( 693 693 <div class={ui.cluster}> 694 694 {currentDid === fr.authorDid && ( 695 695 <button class={ui.buttonDangerInline} onClick={handleDelete}> 696 696 Delete 697 697 </button> 698 698 )} 699 - {canModerate.value && currentDid !== fr.authorDid && ( 699 + {canModerate && currentDid !== fr.authorDid && ( 700 700 <button class={ui.buttonDangerInline} onClick={handleHide}> 701 701 Hide 702 702 </button> 703 703 )} 704 - {canChangeStatus.value ? ( 704 + {canChangeStatus ? ( 705 705 <select 706 706 class={frUi.sortSelect} 707 707 value={fr.status} ··· 755 755 commentCount={fr.commentCount} 756 756 status={fr.status} 757 757 isAuthenticated={isAuthenticated} 758 - canComment={canComment.value} 759 - canModerate={canModerate.value} 758 + canComment={canComment} 759 + canModerate={canModerate} 760 760 currentDid={currentDid} 761 761 currentHandle={currentHandle} 762 762 /> ··· 769 769 authorHandle={fr.authorHandle ?? null} 770 770 /> 771 771 772 - {((currentDid === fr.authorDid || canMarkDuplicate.value) && 773 - fr.status === "requested") || 772 + {((currentDid === fr.authorDid || canMarkDuplicate) && fr.status === "requested") || 774 773 data.duplicateCount > 0 ? ( 775 774 <MergedRequestsSection 776 775 requestId={fr.id} 777 776 duplicateCount={data.duplicateCount} 778 777 canMerge={ 779 - (currentDid === fr.authorDid || canMarkDuplicate.value) && 778 + (currentDid === fr.authorDid || canMarkDuplicate) && 780 779 data.duplicateCount === 0 && 781 780 fr.status === "requested" 782 781 }
+9 -11
packages/kanban/src/ui/pages/board.tsx
··· 1 1 import { useSignal } from "@preact/signals"; 2 2 import { useEffect, useRef } from "preact/hooks"; 3 3 import { auth } from "@exosphere/client/auth"; 4 - import { useCanDo } from "@exosphere/client/permissions"; 4 + import { canDo } from "@exosphere/client/permissions"; 5 5 import { useQuery } from "@exosphere/client/hooks"; 6 6 import { ssrPageData } from "@exosphere/client/ssr-data"; 7 7 import { spherePath } from "@exosphere/client/router"; ··· 48 48 } 49 49 50 50 const isAuthenticated = auth.value.authenticated; 51 - const canCreate = useCanDo("kanban", "create"); 52 - const canChangeStatus = useCanDo("kanban", "changeStatus"); 53 - const canManageSettings = useCanDo("kanban", "manageSettings"); 51 + const canCreate = canDo("kanban", "create"); 52 + const canChangeStatus = canDo("kanban", "changeStatus"); 53 + const canManageSettings = canDo("kanban", "manageSettings"); 54 54 55 - const dnd = useBoardDnd(tasksByColumn, isAuthenticated && canChangeStatus.value); 55 + const dnd = useBoardDnd(tasksByColumn, isAuthenticated && canChangeStatus); 56 56 57 57 const openForm = (status?: string) => { 58 58 formInitialStatus.value = status; ··· 70 70 <div class={kbUi.titleRow}> 71 71 <h1 class={ui.pageTitle}>Flux</h1> 72 72 <div class={kbUi.titleRowActions}> 73 - {isAuthenticated && canManageSettings.value && ( 73 + {isAuthenticated && canManageSettings && ( 74 74 <Link href={spherePath("/flux/settings")} class={kbUi.iconBtn} title="Flux settings"> 75 75 <Settings size={18} /> 76 76 </Link> 77 77 )} 78 - {isAuthenticated && canCreate.value && ( 78 + {isAuthenticated && canCreate && ( 79 79 <button class={ui.button} onClick={() => openForm()}> 80 80 New task 81 81 </button> ··· 127 127 status={col.slug} 128 128 title={col.label} 129 129 tasks={tasksByColumn.value[col.slug] ?? []} 130 - canDrag={isAuthenticated && canChangeStatus.value} 130 + canDrag={isAuthenticated && canChangeStatus} 131 131 draggedTaskId={dnd.dragState.value?.taskId} 132 132 dropTarget={dnd.dropTarget} 133 133 onDragOver={dnd.onColumnDragOver(col.slug)} ··· 135 135 onDrop={dnd.onColumnDrop(col.slug)} 136 136 onCardDragStart={dnd.onDragStart} 137 137 onCardDragEnd={dnd.onDragEnd} 138 - onAddTask={ 139 - isAuthenticated && canCreate.value ? () => openForm(col.slug) : undefined 140 - } 138 + onAddTask={isAuthenticated && canCreate ? () => openForm(col.slug) : undefined} 141 139 /> 142 140 ))} 143 141 </div>
+3 -3
packages/kanban/src/ui/pages/settings.tsx
··· 1 1 import { useEffect } from "preact/hooks"; 2 2 import { auth } from "@exosphere/client/auth"; 3 - import { useCanDo } from "@exosphere/client/permissions"; 3 + import { canDo } from "@exosphere/client/permissions"; 4 4 import { spherePath } from "@exosphere/client/router"; 5 5 import { Link } from "@exosphere/client/link"; 6 6 import { useQuery } from "@exosphere/client/hooks"; ··· 11 11 12 12 export function BoardSettingsPage() { 13 13 const isAuthenticated = auth.value.authenticated; 14 - const canManageSettings = useCanDo("kanban", "manageSettings"); 14 + const canManageSettings = canDo("kanban", "manageSettings"); 15 15 16 16 const prefetched = ssrPageData.peek()?.["kanban-columns"] as 17 17 | Awaited<ReturnType<typeof getColumns>> ··· 27 27 prefetched ? { initialData: prefetched } : undefined, 28 28 ); 29 29 30 - if (!isAuthenticated || !canManageSettings.value) { 30 + if (!isAuthenticated || !canManageSettings) { 31 31 return ( 32 32 <div class={ui.container}> 33 33 <div class={ui.section}>
+12 -12
packages/kanban/src/ui/pages/task.tsx
··· 2 2 import { auth } from "@exosphere/client/auth"; 3 3 import { useLocation, useRoute, spherePath } from "@exosphere/client/router"; 4 4 import { Link } from "@exosphere/client/link"; 5 - import { useCanDo } from "@exosphere/client/permissions"; 5 + import { canDo } from "@exosphere/client/permissions"; 6 6 import { useQuery } from "@exosphere/client/hooks"; 7 7 import { ssrPageData } from "@exosphere/client/ssr-data"; 8 8 import { formatDate } from "@exosphere/client/format"; ··· 392 392 const currentDid = isAuthenticated ? auth.value.did : null; 393 393 const currentHandle = isAuthenticated ? auth.value.handle : null; 394 394 395 - const canComment = useCanDo("kanban", "comment"); 396 - const canModerate = useCanDo("kanban", "moderate"); 397 - const canChangeStatus = useCanDo("kanban", "changeStatus"); 398 - const canManage = useCanDo("kanban", "manageTasks"); 395 + const canComment = canDo("kanban", "comment"); 396 + const canModerate = canDo("kanban", "moderate"); 397 + const canChangeStatus = canDo("kanban", "changeStatus"); 398 + const canManage = canDo("kanban", "manageTasks"); 399 399 400 400 const availableLabels = useSignal<LabelData[]>([]); 401 401 const localLabelIds = useSignal<string[] | null>(null); ··· 403 403 404 404 const task = data?.task; 405 405 const isAuthor = currentDid === task?.authorDid; 406 - const canEdit = isAuthor || canManage.value; 407 - const canEditLabels = canManage.value || isAuthor; 406 + const canEdit = isAuthor || canManage; 407 + const canEditLabels = canManage || isAuthor; 408 408 409 409 useEffect(() => { 410 410 if (canEditLabels) { ··· 571 571 Edit 572 572 </button> 573 573 )} 574 - {(isAuthor || canManage.value) && ( 574 + {(isAuthor || canManage) && ( 575 575 <button class={ui.buttonDangerInline} onClick={handleDelete}> 576 576 Delete 577 577 </button> 578 578 )} 579 - {canModerate.value && !isAuthor && ( 579 + {canModerate && !isAuthor && ( 580 580 <button class={ui.buttonDangerInline} onClick={handleHide}> 581 581 Hide 582 582 </button> 583 583 )} 584 - {canChangeStatus.value ? ( 584 + {canChangeStatus ? ( 585 585 <select 586 586 class={kbUi.statusSelect} 587 587 value={localStatus.value ?? task.status} ··· 638 638 <CommentsSection 639 639 taskId={task.id} 640 640 commentCount={task.commentCount} 641 - canComment={canComment.value} 642 - canModerate={canModerate.value} 641 + canComment={canComment} 642 + canModerate={canModerate} 643 643 currentDid={currentDid} 644 644 currentHandle={currentHandle} 645 645 />