Skip to content

Commit 9f3e020

Browse files
authored
Merge pull request #19 from ClayPulse/dev
Update to tailwind v4
2 parents 8064013 + 9680794 commit 9f3e020

25 files changed

+10089
-17223
lines changed
Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1-
@tailwind base;
2-
@tailwind components;
3-
@tailwind utilities;
1+
@import 'tailwindcss';
2+
3+
@custom-variant dark (&:is([data-mode="dark"] *));
4+
5+
/*
6+
The default border color has changed to `currentColor` in Tailwind CSS v4,
7+
so we've added these compatibility styles to make sure everything still
8+
looks the same as it did with Tailwind CSS v3.
9+
10+
If we ever want to remove these styles, we need to add an explicit border
11+
color utility to any element that depends on these defaults.
12+
*/
13+
@layer base {
14+
*,
15+
::after,
16+
::before,
17+
::backdrop,
18+
::file-selector-button {
19+
border-color: var(--color-gray-200, currentColor);
20+
}
21+
}

package-lock.json

Lines changed: 9902 additions & 17099 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/app/globals.css

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,38 @@
1-
@tailwind base;
2-
@tailwind components;
3-
@tailwind utilities;
4-
/* @import "./preflight.css"; */
1+
@import "tailwindcss";
2+
@config "../tailwind.config.mjs";
3+
4+
/*
5+
The default border color has changed to `currentColor` in Tailwind CSS v4,
6+
so we've added these compatibility styles to make sure everything still
7+
looks the same as it did with Tailwind CSS v3.
8+
9+
If we ever want to remove these styles, we need to add an explicit border
10+
color utility to any element that depends on these defaults.
11+
*/
12+
@layer base {
13+
*,
14+
::after,
15+
::before,
16+
::backdrop,
17+
::file-selector-button {
18+
border-color: var(--color-gray-200, currentColor);
19+
}
20+
}
21+
22+
@utility text-balance {
23+
text-wrap: balance;
24+
}
25+
26+
@utility view-layout {
27+
@apply bg-default flex h-full w-full flex-col items-start justify-between rounded-2xl p-3;
28+
}
529

630
:root {
731
--background: #ffffff;
832
}
933

10-
@media (prefers-color-scheme: dark) {
11-
:root {
12-
--background: #0a0a0a;
13-
}
34+
[data-theme="dark"] {
35+
--background: #0a0a0a;
1436
}
1537

1638
body {
@@ -34,13 +56,3 @@ body {
3456
@apply text-default-foreground;
3557
}
3658
}
37-
38-
@layer utilities {
39-
.text-balance {
40-
text-wrap: balance;
41-
}
42-
43-
.view-layout {
44-
@apply flex h-full w-full flex-col items-start justify-between rounded-2xl bg-default p-3;
45-
}
46-
}

web/components/explorer/explorer.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default function Explorer({
2626
const { platformApi } = usePlatformApi();
2727
const [isProjectSettingsModalOpen, setIsProjectSettingsModalOpen] =
2828
useState(false);
29-
const { openFileView} = useViewManager();
29+
const { openFileView } = useViewManager();
3030

3131
const rootGroupRef = useRef<TreeViewGroupRef | null>(null);
3232

@@ -123,7 +123,7 @@ export default function Explorer({
123123
// Choose project home path
124124
if (!editorContext?.persistSettings?.projectHomePath) {
125125
return (
126-
<div className="h-full w-full space-y-2 bg-content2 p-4">
126+
<div className="bg-content2 h-full w-full space-y-2 p-4">
127127
<p>
128128
You have not set a project home path yet. Please set a project home
129129
path to continue. All your projects will be saved in this directory.
@@ -143,14 +143,14 @@ export default function Explorer({
143143
// Browse inside a project
144144
if (editorContext?.editorStates.project) {
145145
return (
146-
<div className="relative h-full w-full bg-content2 px-4 py-2">
146+
<div className="bg-content2 relative h-full w-full px-4 py-2">
147147
{editorContext.editorStates.projectContent?.length === 0 && (
148-
<div className="pointer-events-none absolute left-0 top-0 m-0 flex h-full w-full flex-col items-center justify-center pb-16">
148+
<div className="pointer-events-none absolute top-0 left-0 m-0 flex h-full w-full flex-col items-center justify-center pb-16">
149149
<p>Empty content. Create a new file to get started.</p>
150150
</div>
151151
)}
152152
<div className="flex h-full w-full flex-col space-y-2">
153-
<div className="flex h-10 w-full items-center rounded-xl bg-default px-3 text-default-foreground">
153+
<div className="bg-default text-default-foreground flex h-10 w-full items-center rounded-xl px-3">
154154
<div className="flex w-full">
155155
<Button
156156
isIconOnly
@@ -166,7 +166,11 @@ export default function Explorer({
166166
size="sm"
167167
onPress={startCreatingNewFile}
168168
>
169-
<Icon uri="/icons/add-file" className="-translate-x-0.5" />
169+
<Icon
170+
uri="/icons/add-file"
171+
className="-translate-x-0.5"
172+
isThemed
173+
/>
170174
</Button>
171175
</div>
172176
<div className="flex">
@@ -201,7 +205,7 @@ export default function Explorer({
201205
// Pick project
202206
else {
203207
return (
204-
<div className="h-full w-full space-y-2 overflow-y-auto bg-content2 p-4">
208+
<div className="bg-content2 h-full w-full space-y-2 overflow-y-auto p-4">
205209
<Button
206210
className="w-full"
207211
onPress={() => {

web/components/interface/context-menu.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
"use client";
22

33
import { ContextMenuState } from "@/lib/types";
4-
import {
5-
Popover,
6-
PopoverContent,
7-
PopoverTrigger,
8-
} from "@heroui/react";
4+
import { Popover, PopoverContent, PopoverTrigger } from "@heroui/react";
95
import { JSX } from "react";
106

117
export default function ContextMenu({
@@ -28,6 +24,9 @@ export default function ContextMenu({
2824
>
2925
<Popover
3026
onClose={() => {
27+
if (process.env.NODE_ENV === 'development') {
28+
console.log("Popover closed");
29+
}
3130
setState({ isOpen: false, x: 0, y: 0 });
3231
}}
3332
isOpen={state.isOpen}

web/components/interface/nav-menu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function MenuPanel({ children }: { children?: React.ReactNode }) {
1111
<>
1212
{isLandscape ? (
1313
<motion.div
14-
className="z-30 hidden h-full w-[400px] flex-shrink-0 md:block"
14+
className="z-30 hidden h-full w-[400px] shrink-0 md:block"
1515
initial={{
1616
x: -400,
1717
}}

web/components/interface/nav.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ export default function Nav({ children }: { children: React.ReactNode }) {
5757

5858

5959
return (
60-
<div className="flex h-screen w-full flex-col overflow-x-hidden">
60+
<div className="grid grid-rows-[max-content_auto] h-screen w-full flex-col overflow-x-hidden">
6161
<PasswordScreen
6262
isOpen={isPasswordScreenOpen}
6363
setIsOpen={setIsPasswordScreenOpen}
6464
/>
6565

6666
{isShowNavbar && (
67-
<div className="fixed z-40 h-12 w-full">
67+
<div className="z-40 h-12 w-full">
6868
<div
6969
className={
7070
"grid h-12 w-full grid-cols-3 grid-rows-1 px-2 py-1 text-default-foreground"
@@ -113,13 +113,13 @@ export default function Nav({ children }: { children: React.ReactNode }) {
113113
)}
114114

115115
<div
116-
className={`relative flex h-full w-full overflow-hidden ${isShowNavbar ? "pt-[48px]" : ""}`}
116+
className={`relative flex h-full w-full overflow-hidden`}
117117
>
118118
{isShowNavbar && (
119119
<NavMenu isMenuOpen={isMenuOpen} setIsMenuOpen={setIsMenuOpen} />
120120
)}
121121

122-
<div className="min-w-0 flex-grow">{children}</div>
122+
<div className="min-w-0 grow">{children}</div>
123123
</div>
124124
</div>
125125
);

web/components/interface/voice-indicator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default function VoiceIndicator() {
3434
<PuffLoader color={colors.green["300"]} size={24} />
3535
) : (
3636
<ClockLoader
37-
className="!shadow-[0px_0px_0px_2px_inset] !shadow-content2-foreground [&>span]:!bg-content2-foreground"
37+
className="shadow-[0px_0px_0px_2px_inset]! shadow-content2-foreground! [&>span]:bg-content2-foreground!"
3838
size={24}
3939
/>
4040
)}

web/components/misc/extension-loader.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useEffect, useRef } from "react";
22
import { createRoot, Root } from "react-dom/client";
3-
import { loadRemote } from "@module-federation/runtime";
3+
import { loadRemote, preloadRemote } from "@module-federation/runtime";
44
import React from "react";
55

66
export default function ExtensionLoader({
@@ -41,16 +41,20 @@ export default function ExtensionLoader({
4141

4242
let isMounted = true;
4343

44-
loadRemote(`${moduleId}/main`).then((mod) => {
45-
// Prevent state updates if component is unmounted
46-
if (!isMounted) return;
44+
loadRemote(`${moduleId}/main`)
45+
.then((module) => {
46+
// Prevent state updates if component is unmounted
47+
if (!isMounted) return;
4748

48-
// @ts-expect-error Types are not available since @module-federation/enhanced
49-
// cannot work in Nextjs App router. Hence types are not generated.
50-
const { default: LoadedExtension, Config } = mod;
49+
// @ts-expect-error Types are not available since @module-federation/enhanced
50+
// cannot work in Nextjs App router. Hence types are not generated.
51+
const { default: LoadedExtension, Config } = module;
5152

52-
renderExtension(LoadedExtension);
53-
});
53+
renderExtension(LoadedExtension);
54+
})
55+
.catch((error) => {
56+
console.error("Error loading remote module:", error);
57+
});
5458

5559
return () => {
5660
// Unmount React module inside the iframe.

web/components/misc/icon.tsx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ export default function Icon({
88
extension = ".png",
99
variant,
1010
className,
11+
isThemed,
1112
}: {
1213
name?: string;
1314
uri?: string;
1415
extension?: string;
1516
variant?: "outlined" | "round" | "sharp" | "two-tone";
1617
className?: string;
18+
isThemed?: boolean;
1719
}) {
1820
const { resolvedTheme } = useTheme();
1921

@@ -22,24 +24,29 @@ export default function Icon({
2224
}
2325
if (name && uri) {
2426
throw new Error(
25-
"Icon component requires either a name or a uri prop, not both.",
27+
"Icon component requires either a name or a uri prop, not both."
2628
);
2729
}
2830

2931
if (name) {
3032
return (
31-
<span
32-
className={
33-
`material-icons${variant ? "-" + variant : ""}` +
34-
(className ? " " + className : "")
35-
}
36-
>
37-
{name}
38-
</span>
33+
<div className="flex justify-center items-center w-full h-full">
34+
<span
35+
className={
36+
`material-icons${variant ? "-" + variant : ""}` +
37+
(className ? " " + className : "")
38+
}
39+
>
40+
{name}
41+
</span>
42+
</div>
3943
);
4044
}
4145

42-
if (resolvedTheme === "dark") {
46+
if (!isThemed) {
47+
const iconUri = uri + extension;
48+
return <img src={iconUri} alt="icon" className={"h-6 w-6 " + className} />;
49+
} else if (resolvedTheme === "dark") {
4350
const darkUri = uri + "-dark" + extension;
4451
return <img src={darkUri} alt="icon" className={"h-6 w-6 " + className} />;
4552
}

0 commit comments

Comments
 (0)