Skip to content

Commit

Permalink
Merge branch 'main' into alerts-table-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kantord authored Jan 24, 2025
2 parents c07eeac + e849194 commit 1931241
Show file tree
Hide file tree
Showing 44 changed files with 1,411 additions and 309 deletions.
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# Changelog

## [0.9.0](https://github.com/stacklok/codegate-ui/compare/v0.8.0...v0.9.0) (2025-01-24)


### Features

* add not_found route ([#194](https://github.com/stacklok/codegate-ui/issues/194)) ([d865730](https://github.com/stacklok/codegate-ui/commit/d865730201eaff07e0e1852750803d0a262e5df6))


### Bug Fixes

* workspace hard delete nits ([#202](https://github.com/stacklok/codegate-ui/issues/202)) ([9129a5b](https://github.com/stacklok/codegate-ui/commit/9129a5b983a1b54f7d3b5cffc19cce85a955045a))

## [0.8.0](https://github.com/stacklok/codegate-ui/compare/v0.7.2...v0.8.0) (2025-01-24)


### Features

* implement hard delete for workspaces & refactor workspaces table to allow multiple actions ([#185](https://github.com/stacklok/codegate-ui/issues/185)) ([a98492a](https://github.com/stacklok/codegate-ui/commit/a98492a8c24067ccd037e6fa753caf9994558967))
* implement use toast mutation for workspaces ([#184](https://github.com/stacklok/codegate-ui/issues/184)) ([a67b265](https://github.com/stacklok/codegate-ui/commit/a67b26518cd5ef1c3f6106b604d45456ffc03cf4))
* redirect to conversation from alerts table ([#191](https://github.com/stacklok/codegate-ui/issues/191)) ([646ed5a](https://github.com/stacklok/codegate-ui/commit/646ed5a6b14661b3956dd2685d9065c4c0d110aa))
* useKbdShortcuts hook & example implementation ([#180](https://github.com/stacklok/codegate-ui/issues/180)) ([0d935a3](https://github.com/stacklok/codegate-ui/commit/0d935a3b263d5c18c86d5ba669554cf3f2e1f3a7))
* useToastMutation hook ([#183](https://github.com/stacklok/codegate-ui/issues/183)) ([9fe55a5](https://github.com/stacklok/codegate-ui/commit/9fe55a524fa776348fcb6719d625f57aac36d60a))


### Bug Fixes

* fix small visual glithc in help menu ([#175](https://github.com/stacklok/codegate-ui/issues/175)) ([7031047](https://github.com/stacklok/codegate-ui/commit/70310476e59085c18755dc3eed6d9a2f09523f0f))
* parsing promptList text and breadcrumb ([#177](https://github.com/stacklok/codegate-ui/issues/177)) ([6da034d](https://github.com/stacklok/codegate-ui/commit/6da034d9ddb028202c14851319e380f61b139473))
* sort filtered alerts before pagination ([#190](https://github.com/stacklok/codegate-ui/issues/190)) ([d844610](https://github.com/stacklok/codegate-ui/commit/d84461041076f9647ceae93220deb071d1897a17))

## [0.7.2](https://github.com/stacklok/codegate-ui/compare/v0.7.1...v0.7.2) (2025-01-22)


Expand Down
16 changes: 14 additions & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import tseslint from "typescript-eslint";
import tailwindPlugin from 'eslint-plugin-tailwindcss'
import tailwindPlugin from "eslint-plugin-tailwindcss";

export default tseslint.config(
{ ignores: ["dist"] },
Expand Down Expand Up @@ -56,6 +56,18 @@ export default tseslint.config(
],
},
],
"no-restricted-imports": [
"error",
{
paths: [
{
importNames: ["useMutation"],
message: "Use the custom `useToastMutation` instead",
name: "@tanstack/react-query",
},
],
},
],
},
}
},
);
3 changes: 0 additions & 3 deletions icons/FlipBackward.svg

This file was deleted.

12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vite-project",
"private": true,
"version": "0.7.2",
"version": "0.9.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -19,7 +19,7 @@
"generate-icons": "npx @svgr/cli --typescript --no-dimensions --replace-attr-values '#2E323A=currentColor' --jsx-runtime automatic --out-dir ./src/components/icons/ -- icons"
},
"dependencies": {
"@hey-api/client-fetch": "^0.6.0",
"@hey-api/client-fetch": "^0.7.1",
"@monaco-editor/react": "^4.6.0",
"@radix-ui/react-dialog": "^1.1.4",
"@radix-ui/react-separator": "^1.1.0",
Expand Down
13 changes: 13 additions & 0 deletions src/Page.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { render } from "./lib/test-utils";
import Page from "./Page";

test("render NotFound route", () => {
const { getByText, getByRole } = render(<Page />, {
routeConfig: {
initialEntries: ["/fake-route"],
},
});

expect(getByText(/Oops! There's nothing here/i)).toBeVisible();
expect(getByRole("button", { name: "Home" })).toBeVisible();
});
2 changes: 2 additions & 0 deletions src/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { RouteChat } from "./routes/route-chat";
import { RouteDashboard } from "./routes/route-dashboard";
import { RouteCertificateSecurity } from "./routes/route-certificate-security";
import { RouteWorkspaceCreation } from "./routes/route-workspace-creation";
import { RouteNotFound } from "./routes/route-not-found";

export default function Page() {
return (
Expand All @@ -23,6 +24,7 @@ export default function Page() {
path="/certificates/security"
element={<RouteCertificateSecurity />}
/>
<Route path="*" element={<RouteNotFound />} />
</Routes>
);
}
34 changes: 34 additions & 0 deletions src/components/EmptyState.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
interface EmptyStateProps {
children?: React.ReactNode;
title?: string | React.ReactNode;
description?: string | React.ReactNode;
illustration?: React.ReactNode;
}

export function EmptyState({
illustration,
title,
children,
description,
}: EmptyStateProps) {
return (
<>
<div className="my-4">
{illustration != null && (
<div className="m-auto flex w-full justify-center pb-2">
{illustration}
</div>
)}
<div className="mb-1 text-center text-xl font-medium text-gray-900">
{title}
</div>
<div className="m-auto mb-6 text-center font-normal text-secondary">
{description}
</div>
{children != null && (
<div className="flex justify-center">{children}</div>
)}
</div>
</>
);
}
17 changes: 0 additions & 17 deletions src/components/icons/FlipBackward.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/components/icons/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export { default as Continue } from "./Continue";
export { default as Copilot } from "./Copilot";
export { default as Discord } from "./Discord";
export { default as FlipBackward } from "./FlipBackward";
export { default as Github } from "./Github";
export { default as Youtube } from "./Youtube";
86 changes: 86 additions & 0 deletions src/context/confirm-context.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
"use client";

import {
Button,
Dialog,
DialogContent,
DialogFooter,
DialogHeader,
DialogModal,
DialogModalOverlay,
DialogTitle,
} from "@stacklok/ui-kit";
import type { ReactNode } from "react";
import { createContext, useState } from "react";

type Buttons = {
yes: ReactNode;
no: ReactNode;
};

type Config = {
buttons: Buttons;
title?: ReactNode;
isDestructive?: boolean;
};

type Question = {
message: ReactNode;
config: Config;
resolve: (value: boolean) => void;
};

type ConfirmContextType = {
confirm: (message: ReactNode, config: Config) => Promise<boolean>;
};

export const ConfirmContext = createContext<ConfirmContextType | null>(null);

Check warning on line 37 in src/context/confirm-context.tsx

View workflow job for this annotation

GitHub Actions / Static Checks / ESLint Check

Fast refresh only works when a file only exports components. Move your React context(s) to a separate file

export function ConfirmProvider({ children }: { children: ReactNode }) {
const [activeQuestion, setActiveQuestion] = useState<Question | null>(null);
const [isOpen, setIsOpen] = useState<boolean>(false);

const handleAnswer = (answer: boolean) => {
if (activeQuestion === null) return;
activeQuestion.resolve(answer);
setIsOpen(false);
};

const confirm = (message: ReactNode, config: Config) => {
return new Promise<boolean>((resolve) => {
setActiveQuestion({ message, config, resolve });
setIsOpen(true);
});
};

return (
<ConfirmContext.Provider value={{ confirm }}>
{children}

<DialogModalOverlay isDismissable={false} isOpen={isOpen}>
<DialogModal>
<Dialog>
<DialogHeader>
<DialogTitle>{activeQuestion?.config.title}</DialogTitle>
</DialogHeader>
<DialogContent>{activeQuestion?.message}</DialogContent>
<DialogFooter>
<div className="flex grow justify-end gap-2">
<Button variant="secondary" onPress={() => handleAnswer(false)}>
{activeQuestion?.config.buttons.no ?? "&nbsp;"}
</Button>
<Button
isDestructive={activeQuestion?.config.isDestructive}
variant="primary"
onPress={() => handleAnswer(true)}
>
{activeQuestion?.config.buttons.yes ?? "&nbsp;"}
</Button>
</div>
</DialogFooter>
</Dialog>
</DialogModal>
</DialogModalOverlay>
</ConfirmContext.Provider>
);
}

This file was deleted.

This file was deleted.

Loading

0 comments on commit 1931241

Please sign in to comment.