Skip to content

Commit ea9639f

Browse files
committed
ui: add theme button
1 parent 4617237 commit ea9639f

File tree

35 files changed

+2108
-142
lines changed

35 files changed

+2108
-142
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { $userRealm } from "alepha/api/users";
22

33
export class AppSecurity {
4-
realm = $userRealm();
4+
realm = $userRealm({});
55
}

apps/example-saas/src/main.server.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { AlephaDevtools } from "@alepha/devtools";
21
import { Alepha, run } from "alepha";
32
import { AlephaApiFiles } from "alepha/api/files";
43
import { AppRouter } from "./AppRouter.ts";
@@ -7,7 +6,6 @@ import { AppSecurity } from "./AppSecurity.ts";
76
const alepha = Alepha.create();
87

98
alepha.with(AlephaApiFiles);
10-
alepha.with(AlephaDevtools);
119
alepha.with(AppSecurity);
1210
alepha.with(AppRouter);
1311

apps/roadmap/src/components/project/ProjectBoard.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ const ProjectBoard = () => {
7373
const result = await taskApi.getTasks({
7474
params: { projectId: project.id },
7575
query: {
76+
size: 100,
7677
status,
7778
search: searchQuery || undefined,
7879
},

apps/roadmap/src/components/project/QuestLog.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const QuestLog = () => {
8080
</Flex>
8181
<Flex flex={1} />
8282
<Flex px={1}>
83-
<ActionIcon disabled variant={"subtle"}>
83+
<ActionIcon variant={"subtle"}>
8484
<IconSelector size={theme.icon.size.md} />
8585
</ActionIcon>
8686
<Menu
@@ -90,7 +90,7 @@ const QuestLog = () => {
9090
position="bottom-start"
9191
>
9292
<Menu.Target>
93-
<ActionIcon disabled variant={"subtle"}>
93+
<ActionIcon variant={"subtle"}>
9494
<IconDots size={theme.icon.size.md} />
9595
</ActionIcon>
9696
</Menu.Target>

apps/roadmap/src/components/shared/HeaderActions.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useRouter } from "@alepha/react";
22
import { useAuth } from "@alepha/react/auth";
33
import { useI18n } from "@alepha/react/i18n";
4-
import { DarkModeButton, LanguageButton } from "@alepha/ui";
4+
import { DarkModeButton, LanguageButton, ThemeButton } from "@alepha/ui";
55
import type { AuthRouter } from "@alepha/ui/auth";
66
import { Flex, Menu } from "@mantine/core";
77
import { IconLogout, IconSettings, IconUser } from "@tabler/icons-react";
@@ -15,6 +15,7 @@ const HeaderActions = () => {
1515
return (
1616
<Flex gap={"xs"} align="center" justify="center">
1717
<AuthButton />
18+
<ThemeButton />
1819
<LanguageButton actionProps={{ variant: "subtle" }} />
1920
<DarkModeButton actionProps={{ variant: "subtle" }} />
2021
</Flex>

apps/roadmap/src/constants/theme.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import type { MantineColorScheme, MantineTheme } from "@mantine/core";
33
export const theme = {
44
defaultColorScheme: "dark" as MantineColorScheme,
55
mantine: {
6-
primaryColor: "gray",
7-
primaryShade: {
8-
light: 9,
9-
dark: 8,
10-
},
6+
//primaryColor: "gray",
7+
// primaryShade: {
8+
// light: 9,
9+
// dark: 8,
10+
// },
1111
cursorType: "pointer",
1212
} as MantineTheme,
1313
container: {

apps/roadmap/src/styles.css

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -28,59 +28,9 @@ html {
2828
}
2929
}
3030

31-
.root {
32-
display: flex;
33-
flex-direction: column;
34-
width: 100%;
35-
height: 100%;
36-
}
37-
38-
.shadow {
39-
box-shadow:
40-
0 1px 3px var(--alepha-shadow),
41-
0 1px 2px var(--alepha-shadow);
42-
}
43-
44-
.shadow-2 {
45-
box-shadow:
46-
0 4px 6px var(--alepha-shadow),
47-
0 1px 3px var(--alepha-shadow),
48-
inset 0 -1px 4px rgba(255, 255, 255, 0.1);
49-
}
50-
51-
/*
52-
* ---------------------------------------------------------------------------------------------------------------------
53-
* Mantine overrides
54-
*/
55-
56-
pre > code {
57-
background-color: transparent !important;
58-
padding: 0 !important;
59-
}
60-
61-
.mantine-Drawer-content {
62-
border-left: 1px solid var(--paper-border-color);
63-
border-right: 1px solid var(--paper-border-color);
64-
}
65-
66-
.mantine-Modal-content {
67-
border: 1px solid var(--alepha-border);
68-
}
69-
70-
.mantine-SegmentedControl-root {
71-
background-color: var(--alepha-surface);
72-
border: 1px solid var(--alepha-border);
73-
}
74-
75-
.mantine-Action-iconOnly .mantine-Button-section {
76-
margin-inline-end: 4px;
77-
margin-inline-start: 4px;
78-
}
79-
8031
.tiptap.ProseMirror {
8132
height: 100%;
8233
min-height: 200px;
83-
background-color: var(--alepha-surface);
8434
}
8535

8636
/**

packages/alepha/src/api-users/primitives/$userRealm.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const $userRealm = (
4848
const userRealmProvider = alepha.inject(UserRealmProvider);
4949
const name = options.realm?.name ?? DEFAULT_USER_REALM_NAME;
5050

51-
userRealmProvider.register(name, options);
51+
const userRealm = userRealmProvider.register(name, options);
5252

5353
const realm: UserRealmPrimitive = $realm({
5454
...options.realm,
@@ -111,13 +111,19 @@ export const $userRealm = (
111111
const auth: Record<string, AuthPrimitive> = {};
112112
if (identities.credentials) {
113113
auth.credentials = $authCredentials(realm);
114+
} else {
115+
// if credentials auth is disabled, disable registration as well
116+
userRealm.settings.registrationAllowed = false;
114117
}
118+
115119
if (identities.google) {
116120
auth.google = $authGoogle(realm);
117121
}
122+
118123
if (identities.github) {
119124
auth.github = $authGithub(realm);
120125
}
126+
121127
alepha.with(() => auth);
122128
}
123129

packages/alepha/src/api-users/providers/UserRealmProvider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export class UserRealmProvider {
7070
},
7171
},
7272
});
73+
return this.getRealm(userRealmName);
7374
}
7475

7576
/**

packages/alepha/src/server-cookies/providers/ServerCookiesProvider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
$hook,
1212
$inject,
1313
Alepha,
14+
AlephaError,
1415
type Static,
1516
type TSchema,
1617
t,
@@ -89,7 +90,7 @@ export class ServerCookiesProvider {
8990
this.alepha.context.get<ServerRequest>("request")?.cookies;
9091
if (cookies) return cookies;
9192
if (contextCookies) return contextCookies;
92-
throw new Error(
93+
throw new AlephaError(
9394
"Cookie context is not available. This method must be called within a server request cycle.",
9495
);
9596
}

0 commit comments

Comments
 (0)