Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/web/app/(org)/dashboard/_components/Navbar/Items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ const NavItem = ({
onMouseLeave={() => {
iconRef.current?.stopAnimation();
}}
prefetch={false}
prefetch={true}
passHref
className={classNames(
"relative border border-transparent transition z-3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ const SpacesList = ({ toggleMobileNav }: { toggleMobileNav?: () => void }) => {
<Link
passHref
onClick={() => toggleMobileNav?.()}
prefetch={false}
prefetch={true}
onMouseEnter={() => layersIconRef.current?.startAnimation()}
onMouseLeave={() => layersIconRef.current?.stopAnimation()}
href="/dashboard/spaces/browse"
Expand Down
1 change: 1 addition & 0 deletions apps/web/app/(org)/dashboard/_components/Navbar/Top.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ const MenuItem = memo(({ icon, name, href, onClick, iconClassName }: Props) => {
<Link
className="flex gap-2 items-center w-full"
href={href ?? "#"}
prefetch={true}
onClick={onClick}
>
<div className="flex-shrink-0 flex items-center justify-center w-3.5 h-3.5">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
DialogTitle,
Input,
} from "@cap/ui";
import type { Organisation } from "@cap/web-domain";
import { faTrashCan } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Effect } from "effect";
Expand All @@ -28,10 +27,10 @@ const DeleteOrgDialog = ({ open, onOpenChange }: DeleteOrgDialogProps) => {
const rpc = useRpcClient();
const inputId = useId();
const router = useRouter();
const deleteOrg = useEffectMutation({
const softDeleteOrg = useEffectMutation({
mutationFn: Effect.fn(function* () {
if (!activeOrganization) return;
yield* rpc.OrganisationDelete({
yield* rpc.OrganisationSoftDelete({
id: activeOrganization.organization.id,
});
}),
Expand Down Expand Up @@ -73,15 +72,15 @@ const DeleteOrgDialog = ({ open, onOpenChange }: DeleteOrgDialogProps) => {
<Button
size="sm"
variant="destructive"
onClick={() => deleteOrg.mutate()}
spinner={deleteOrg.isPending}
onClick={() => softDeleteOrg.mutate()}
spinner={softDeleteOrg.isPending}
disabled={
organizationData?.length === 1 ||
organizationName !== activeOrganization?.organization.name ||
deleteOrg.isPending
softDeleteOrg.isPending
}
>
{deleteOrg.isPending ? "Deleting..." : "Delete"}
{softDeleteOrg.isPending ? "Deleting..." : "Delete"}
</Button>
</DialogFooter>
</DialogContent>
Expand Down
4 changes: 2 additions & 2 deletions packages/web-backend/src/Organisations/OrganisationsRpcs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export const OrganisationsRpcsLive = Organisation.OrganisationRpcs.toLayer(
S3Error: () => new InternalError({ type: "s3" }),
}),
),
OrganisationDelete: (data) =>
orgs.deleteOrg(data.id).pipe(
OrganisationSoftDelete: (data) =>
orgs.softDelete(data.id).pipe(
Effect.catchTags({
DatabaseError: () => new InternalError({ type: "database" }),
}),
Expand Down
4 changes: 2 additions & 2 deletions packages/web-backend/src/Organisations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class Organisations extends Effect.Service<Organisations>()(
}
});

const deleteOrg = Effect.fn("Organisations.deleteOrg")(function* (
const softDelete = Effect.fn("Organisations.softDelete")(function* (
id: Organisation.OrganisationId,
) {
const user = yield* CurrentUser;
Expand Down Expand Up @@ -89,7 +89,7 @@ export class Organisations extends Effect.Service<Organisations>()(
}),
);
});
return { update, deleteOrg };
return { update, softDelete };
}),
dependencies: [
ImageUploads.Default,
Expand Down
11 changes: 4 additions & 7 deletions packages/web-domain/src/Organisation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ export class Organisation extends Schema.Class<Organisation>("Organisation")({
name: Schema.String,
}) {}

export const OrganisationDelete = Schema.Struct({
id: OrganisationId,
});
export type OrganisationDelete = Schema.Schema.Type<typeof OrganisationDelete>;

export const OrganisationUpdate = Schema.Struct({
id: OrganisationId,
image: Schema.optional(ImageUpdatePayload),
Expand All @@ -39,8 +34,10 @@ export class OrganisationRpcs extends RpcGroup.make(
payload: OrganisationUpdate,
error: Schema.Union(InternalError, PolicyDeniedError, NotFoundError),
}).middleware(RpcAuthMiddleware),
Rpc.make("OrganisationDelete", {
payload: OrganisationDelete,
Rpc.make("OrganisationSoftDelete", {
payload: Schema.Struct({
id: OrganisationId,
}),
error: Schema.Union(InternalError, PolicyDeniedError, NotFoundError),
}).middleware(RpcAuthMiddleware),
) {}