Skip to content

Commit 4ea33a2

Browse files
authored
refactor(ui): blank page content when no organizations are available (#41)
* refactor(ui): blank page content when no organizations are available * ci: simply the ci process
1 parent 6312f5e commit 4ea33a2

File tree

4 files changed

+22
-43
lines changed

4 files changed

+22
-43
lines changed

.github/workflows/pr.yml

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,9 @@ on:
77
branches: [master]
88

99
jobs:
10-
test:
11-
name: test
10+
pr-check:
11+
name: pr-check
1212
runs-on: ubuntu-latest
13-
steps:
14-
# This step uses the actions/checkout action to download a copy of your repository on the runner.
15-
- name: Checkout repo
16-
uses: actions/checkout@v4
17-
18-
# This step uses the pnpm/action-setup action to set up pnpm on the runner.
19-
- name: Install pnpm
20-
uses: pnpm/action-setup@v3
21-
with:
22-
version: 9
23-
24-
# This step uses the actions/setup-node action to set up a Node.js environment on the runner.
25-
- name: Use Node.js
26-
uses: actions/setup-node@v4
27-
with:
28-
node-version-file: .nvmrc
29-
cache: pnpm
30-
31-
# This step runs the install script for the selected node package manager.
32-
- name: Install dependencies
33-
run: pnpm install
34-
35-
# This step runs the test script if there is one specified under the scripts key in your package.json file.
36-
- name: Test
37-
run: pnpm test:ci
38-
39-
build:
40-
name: build
41-
needs: [test]
42-
runs-on: ubuntu-latest
43-
strategy:
44-
matrix:
45-
node-version: [20]
4613
steps:
4714
# This step uses the actions/checkout action to download a copy of your repository on the runner.
4815
- name: Checkout repo
@@ -68,3 +35,7 @@ jobs:
6835
# This step runs the build script if there is one specified under the scripts key in your package.json file.
6936
- name: Build
7037
run: pnpm build
38+
39+
# This step runs the test script if there is one specified under the scripts key in your package.json file.
40+
- name: Test
41+
run: pnpm test:ci

src/routers/app/ui/components/button.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { PropsWithChildren } from "hono/jsx";
1+
import type { JSX, PropsWithChildren } from "hono/jsx";
22

33
const buttonStyles = {
44
primary:
@@ -21,10 +21,13 @@ export function Button({
2121
children,
2222
variant = "primary",
2323
size = "md",
24+
class: className,
2425
...props
25-
}: PropsWithChildren<{ variant?: keyof typeof buttonStyles; size?: keyof typeof buttonSize }>) {
26+
}: PropsWithChildren<
27+
{ variant?: keyof typeof buttonStyles; size?: keyof typeof buttonSize } & JSX.IntrinsicElements["button"]
28+
>) {
2629
return (
27-
<button class={getButtonStyles(variant, size)} {...props}>
30+
<button class={[getButtonStyles(variant, size), className].filter(Boolean).join(" ")} {...props}>
2831
{children}
2932
</button>
3033
);

src/routers/app/ui/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Hono } from "hono";
22

33
import { db } from "@/config/db/index.mjs";
44

5-
import { DashboardLandingPage } from "./pages/app.index.js";
5+
import { NoOrganizationPage } from "./pages/app.index.js";
66
import { LoginPage } from "./pages/app.login.js";
77
import { WorkspaceLandingPage } from "./pages/app.$workspace.index.js";
88
import { WorkspaceEditPage } from "./pages/app.$workspace.edit.js";
@@ -26,12 +26,12 @@ app.get("/", checkUserAuthed, async (c) => {
2626

2727
const tenants = relationships.map((r) => r.tenant);
2828

29-
if (tenants.length === 1 && view_all !== "true") {
29+
if (tenants.length >= 1 && view_all !== "true") {
3030
const tenant = tenants[0];
3131
return c.redirect(`/app/${tenant.workspace}`);
3232
}
3333

34-
return c.html(<DashboardLandingPage user={user} tenants={tenants} />);
34+
return c.html(<NoOrganizationPage user={user} tenants={tenants} />);
3535
});
3636

3737
app.get("/login", async (c) => {

src/routers/app/ui/pages/app.index.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@ import type { FC } from "hono/jsx";
22

33
import { RootDocument } from "../layouts/root-document.js";
44
import { AppContainer, type AppContainerProps } from "../layouts/app-container.js";
5+
import { Button } from "../components/button.js";
56

6-
export const DashboardLandingPage: FC<{} & Omit<AppContainerProps, "tenant">> = ({ user, tenants }) => {
7+
export const NoOrganizationPage: FC<{} & Omit<AppContainerProps, "tenant">> = ({ user, tenants }) => {
78
return (
89
<RootDocument title="Simple Logging Server">
910
<AppContainer user={user} tenants={tenants} tenant={null} mainClass="p-2 md:p-4">
10-
<p>There is no content on this page</p>
11+
<div class="grid gap-2">
12+
<p>You are not a part of any active organizations.</p>
13+
<p>Create your own organization!.</p>
14+
<Button class="w-auto">Create organization</Button>
15+
</div>
1116
</AppContainer>
1217
</RootDocument>
1318
);

0 commit comments

Comments
 (0)