-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: added cycle history, UX improvements
- Loading branch information
1 parent
aa4ba55
commit 9a4123d
Showing
53 changed files
with
652 additions
and
172 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
apps/server/prisma/migrations/20241118032222_add_cycle_and_project_history/migration.sql
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,45 @@ | ||
-- AlterTable | ||
ALTER TABLE "IssueHistory" ADD COLUMN "fromCycleId" TEXT, | ||
ADD COLUMN "toCycleId" TEXT; | ||
|
||
-- CreateTable | ||
CREATE TABLE "CycleHistory" ( | ||
"id" TEXT NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
"deleted" TIMESTAMP(3), | ||
"userId" TEXT, | ||
"cycleId" TEXT NOT NULL, | ||
"issueId" TEXT NOT NULL, | ||
"fromStateId" TEXT, | ||
"toStateId" TEXT, | ||
"fromEstimate" INTEGER, | ||
"toEstimate" INTEGER, | ||
"isRemoved" BOOLEAN NOT NULL, | ||
|
||
CONSTRAINT "CycleHistory_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "ProjectHistory" ( | ||
"id" TEXT NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
"deleted" TIMESTAMP(3), | ||
"userId" TEXT, | ||
"projectId" TEXT NOT NULL, | ||
"issueId" TEXT NOT NULL, | ||
"fromStateId" TEXT, | ||
"toStateId" TEXT, | ||
"fromEstimate" INTEGER, | ||
"toEstimate" INTEGER, | ||
"isRemoved" BOOLEAN NOT NULL, | ||
|
||
CONSTRAINT "ProjectHistory_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "CycleHistory" ADD CONSTRAINT "CycleHistory_cycleId_fkey" FOREIGN KEY ("cycleId") REFERENCES "Cycle"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "ProjectHistory" ADD CONSTRAINT "ProjectHistory_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "Project"("id") ON DELETE RESTRICT ON UPDATE CASCADE; |
31 changes: 31 additions & 0 deletions
31
apps/server/prisma/migrations/20241120172902_add_ai_cycle_project_history/migration.sql
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 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the column `isRemoved` on the `CycleHistory` table. All the data in the column will be lost. | ||
- You are about to drop the column `isRemoved` on the `ProjectHistory` table. All the data in the column will be lost. | ||
- Added the required column `changeType` to the `CycleHistory` table without a default value. This is not possible if the table is not empty. | ||
- Added the required column `changeType` to the `ProjectHistory` table without a default value. This is not possible if the table is not empty. | ||
*/ | ||
-- CreateEnum | ||
CREATE TYPE "CycleHistoryChangeType" AS ENUM ('ADDED', 'MOVED', 'UPDATED', 'REMOVED'); | ||
|
||
-- CreateEnum | ||
CREATE TYPE "ProjectHistoryChangeType" AS ENUM ('ADDED', 'MOVED', 'UPDATED', 'REMOVED'); | ||
|
||
-- AlterTable | ||
ALTER TABLE "CycleHistory" DROP COLUMN "isRemoved", | ||
ADD COLUMN "changeType" "CycleHistoryChangeType" NOT NULL; | ||
|
||
-- AlterTable | ||
ALTER TABLE "ProjectHistory" DROP COLUMN "isRemoved", | ||
ADD COLUMN "changeType" "ProjectHistoryChangeType" NOT NULL; | ||
|
||
-- AlterTable | ||
ALTER TABLE "UsersOnWorkspaces" ADD COLUMN "ai" BOOLEAN NOT NULL DEFAULT false; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "CycleHistory" ADD CONSTRAINT "CycleHistory_issueId_fkey" FOREIGN KEY ("issueId") REFERENCES "Issue"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "ProjectHistory" ADD CONSTRAINT "ProjectHistory_issueId_fkey" FOREIGN KEY ("issueId") REFERENCES "Issue"("id") ON DELETE RESTRICT ON UPDATE CASCADE; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,44 @@ | ||
import { Button } from '@tegonhq/ui/components/button'; | ||
import { Separator } from '@tegonhq/ui/components/separator'; | ||
import { AI } from '@tegonhq/ui/icons'; | ||
import { observer } from 'mobx-react-lite'; | ||
|
||
import { useCommonStore } from 'hooks/use-common-store'; | ||
|
||
interface HeaderLayoutProps { | ||
children: React.ReactNode; | ||
actions?: React.ReactNode; | ||
} | ||
|
||
export function HeaderLayout({ children, actions }: HeaderLayoutProps) { | ||
return ( | ||
<header className="flex px-4 w-full items-center"> | ||
<div className="flex justify-between w-full py-2.5 h-[48px] items-center"> | ||
<div className="flex gap-1 items-center">{children}</div> | ||
{actions && <div>{actions}</div>} | ||
</div> | ||
</header> | ||
); | ||
} | ||
export const HeaderLayout = observer( | ||
({ children, actions }: HeaderLayoutProps) => { | ||
const commonStore = useCommonStore(); | ||
|
||
return ( | ||
<header className="flex px-4 w-full items-center"> | ||
<div className="flex justify-between w-full py-2.5 h-[48px] items-center"> | ||
<div className="flex gap-1 items-center">{children}</div> | ||
<div className="flex h-full items-center gap-1"> | ||
{actions && ( | ||
<> | ||
<div className="flex items-center">{actions}</div> | ||
<Separator orientation="vertical" className="h-full" /> | ||
</> | ||
)} | ||
<Button | ||
size="sm" | ||
variant="ghost" | ||
isActive={commonStore.chatOpen} | ||
className="ml-0.5" | ||
onClick={() => | ||
commonStore.update({ chatOpen: !commonStore.chatOpen }) | ||
} | ||
> | ||
<AI /> | ||
</Button> | ||
</div> | ||
</div> | ||
</header> | ||
); | ||
}, | ||
); |
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
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,55 @@ | ||
import { | ||
ResizableHandle, | ||
ResizablePanel, | ||
ResizablePanelGroup, | ||
} from '@tegonhq/ui/components/resizable'; | ||
import { cn } from '@tegonhq/ui/lib/utils'; | ||
import { observer } from 'mobx-react-lite'; | ||
|
||
import { useContextStore } from 'store/global-context-provider'; | ||
|
||
import { ContentBox } from './content-box'; | ||
interface MainLayoutProps { | ||
header: React.ReactNode; | ||
children: React.ReactNode; | ||
className?: string; | ||
} | ||
|
||
export const MainLayout = observer( | ||
({ header, children, className }: MainLayoutProps) => { | ||
const { commonStore } = useContextStore(); | ||
|
||
return ( | ||
<main className={cn('flex flex-col h-[100vh]', className)}> | ||
{header} | ||
<ResizablePanelGroup direction="horizontal"> | ||
<ResizablePanel | ||
collapsible={false} | ||
order={1} | ||
id="app-layout" | ||
className="w-full" | ||
> | ||
{children} | ||
</ResizablePanel> | ||
{commonStore.chatOpen && ( | ||
<> | ||
<ResizableHandle className="bg-transparent" /> | ||
<ResizablePanel | ||
collapsible={false} | ||
maxSize={50} | ||
minSize={10} | ||
defaultSize={25} | ||
order={2} | ||
id="app-layout-chat" | ||
> | ||
<ContentBox className="pl-0"> | ||
<h2></h2> | ||
</ContentBox> | ||
</ResizablePanel> | ||
</> | ||
)} | ||
</ResizablePanelGroup> | ||
</main> | ||
); | ||
}, | ||
); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import type { CommonStoreType } from 'store/common'; | ||
import { useContextStore } from 'store/global-context-provider'; | ||
|
||
export const useCommonStore = (): CommonStoreType => { | ||
const { commonStore } = useContextStore(); | ||
|
||
return commonStore; | ||
}; |
Oops, something went wrong.