-
Notifications
You must be signed in to change notification settings - Fork 944
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move Actions & Attributes pages over to server components (#495)
* feat: server rendering of event actions summary page & server actions * chore: renaming event to action and minor refactoring * fix: logging message * delete: unnecessary file * feat: migrate attributes overview page * feat: impl grouped page & layout, logically differentiate attributes and actions * pnpm format * fix: logical addressing of dirs and minot bugs * move: actionsAndAttributes navbar to dedicated dir from components * fix: use server-only build-time checks and move actionsAttributes navbar * revert: unnecessary docker compose changes * resolve merge conflicts dynamically * fix: address feedback comments * use sparkles icon from heroicons * fix updated action not updating in table * remove async from client function due to warning * move router.refresh in AddNoActionModal * small rename * feat: replace swr w server action in ActionSettingsTab * replace custom error with ResourceNotFoundError error class --------- Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
- Loading branch information
1 parent
5bfaad9
commit 3824d95
Showing
33 changed files
with
669 additions
and
373 deletions.
There are no files selected for viewing
10 changes: 5 additions & 5 deletions
10
...vents_attributes/EventsAttributesTabs.tsx → ...sAndAttributes)/ActionsAttributesTabs.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
.../(app)/environments/[environmentId]/(actionsAndAttributes)/actions/ActionClassesTable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
"use client"; | ||
|
||
import { Button } from "@formbricks/ui"; | ||
import { CursorArrowRaysIcon } from "@heroicons/react/24/solid"; | ||
import { useState } from "react"; | ||
import AddNoCodeActionModal from "./AddNoCodeActionModal"; | ||
import ActionDetailModal from "./ActionDetailModal"; | ||
import { TActionClass } from "@formbricks/types/v1/actionClasses"; | ||
|
||
export default function ActionClassesTable({ | ||
environmentId, | ||
actionClasses, | ||
children: [TableHeading, actionRows], | ||
}: { | ||
environmentId: string; | ||
actionClasses: TActionClass[]; | ||
children: [JSX.Element, JSX.Element[]]; | ||
}) { | ||
const [isActionDetailModalOpen, setActionDetailModalOpen] = useState(false); | ||
const [isAddActionModalOpen, setAddActionModalOpen] = useState(false); | ||
|
||
const [activeActionClass, setActiveActionClass] = useState<TActionClass>({ | ||
environmentId, | ||
id: "", | ||
name: "", | ||
type: "noCode", | ||
description: "", | ||
noCodeConfig: null, | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
}); | ||
|
||
const handleOpenActionDetailModalClick = (e, actionClass: TActionClass) => { | ||
e.preventDefault(); | ||
setActiveActionClass(actionClass); | ||
setActionDetailModalOpen(true); | ||
}; | ||
|
||
return ( | ||
<> | ||
<div className="mb-6 text-right"> | ||
<Button | ||
variant="darkCTA" | ||
onClick={() => { | ||
setAddActionModalOpen(true); | ||
}}> | ||
<CursorArrowRaysIcon className="mr-2 h-5 w-5 text-white" /> | ||
Add Action | ||
</Button> | ||
</div> | ||
<div className="rounded-lg border border-slate-200"> | ||
{TableHeading} | ||
<div className="grid-cols-7"> | ||
{actionClasses.map((actionClass, index) => ( | ||
<button | ||
onClick={(e) => { | ||
handleOpenActionDetailModalClick(e, actionClass); | ||
}} | ||
className="w-full" | ||
key={actionClass.id}> | ||
{actionRows[index]} | ||
</button> | ||
))} | ||
</div> | ||
</div> | ||
<ActionDetailModal | ||
environmentId={environmentId} | ||
open={isActionDetailModalOpen} | ||
setOpen={setActionDetailModalOpen} | ||
actionClass={activeActionClass} | ||
/> | ||
<AddNoCodeActionModal | ||
environmentId={environmentId} | ||
open={isAddActionModalOpen} | ||
setOpen={setAddActionModalOpen} | ||
/> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...b/app/(app)/environments/[environmentId]/(actionsAndAttributes)/actions/ActionRowData.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { timeSinceConditionally } from "@formbricks/lib/time"; | ||
import { TActionClass } from "@formbricks/types/v1/actionClasses"; | ||
import { CodeBracketIcon, CursorArrowRaysIcon, SparklesIcon } from "@heroicons/react/24/solid"; | ||
|
||
export default function ActionClassDataRow({ actionClass }: { actionClass: TActionClass }) { | ||
return ( | ||
<div className="m-2 grid h-16 grid-cols-6 content-center rounded-lg hover:bg-slate-100"> | ||
<div className="col-span-4 flex items-center pl-6 text-sm"> | ||
<div className="flex items-center"> | ||
<div className="h-5 w-5 flex-shrink-0 text-slate-500"> | ||
{actionClass.type === "code" ? ( | ||
<CodeBracketIcon /> | ||
) : actionClass.type === "noCode" ? ( | ||
<CursorArrowRaysIcon /> | ||
) : actionClass.type === "automatic" ? ( | ||
<SparklesIcon /> | ||
) : null} | ||
</div> | ||
<div className="ml-4 text-left"> | ||
<div className="font-medium text-slate-900">{actionClass.name}</div> | ||
<div className="text-xs text-slate-400">{actionClass.description}</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div className="col-span-2 my-auto whitespace-nowrap text-center text-sm text-slate-500"> | ||
{timeSinceConditionally(actionClass.createdAt.toString())} | ||
</div> | ||
<div className="text-center"></div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
.../(app)/environments/[environmentId]/(actionsAndAttributes)/actions/ActionTableHeading.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export default function ActionTableHeading() { | ||
return ( | ||
<> | ||
<div className="grid h-12 grid-cols-6 content-center rounded-lg bg-slate-100 text-left text-sm font-semibold text-slate-900"> | ||
<span className="sr-only">Edit</span> | ||
<div className="col-span-4 pl-6 ">User Actions</div> | ||
<div className="col-span-2 text-center">Created</div> | ||
</div> | ||
</> | ||
); | ||
} |
Oops, something went wrong.
3824d95
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
formbricks-cloud – ./apps/web
app.formbricks.com
formbricks-cloud-git-main-formbricks.vercel.app
formbricks-cloud.vercel.app
formbricks-cloud-formbricks.vercel.app
3824d95
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
formbricks-com – ./apps/formbricks-com
formbricks-com-formbricks.vercel.app
formbricks-com.vercel.app
formbricks-com-git-main-formbricks.vercel.app
formbricks.com
www.formbricks.com