Skip to content

Commit 7948162

Browse files
committed
πŸ€– refactor: Convert App.tsx to Tailwind CSS
- Remove @emotion/styled dependency from App.tsx - Replace 4 styled components with Tailwind utility classes - AppContainer β†’ flex h-screen overflow-hidden bg-[#1e1e1e] - MainContent β†’ flex-1 flex flex-col overflow-hidden min-w-0 - ContentArea β†’ flex-1 flex overflow-hidden - WelcomeView β†’ text-center max-w-[800px] mx-auto with clamp() in style - Use [@media(max-width:768px)]: arbitrary variants for responsive design - Preserve all clamp() dynamic values in inline styles (font-size, padding) - Maintain all layout behavior and responsiveness - Code reduction: 810 β†’ 750 lines (7% reduction) All type checks passing, maintains feature parity
1 parent f4bbe5f commit 7948162

File tree

1 file changed

+10
-70
lines changed

1 file changed

+10
-70
lines changed

β€Žsrc/App.tsxβ€Ž

Lines changed: 10 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useState, useEffect, useCallback, useRef } from "react";
2-
import styled from "@emotion/styled";
2+
import { cn } from "@/lib/utils";
33
import "./styles/globals.css";
44
import type { ProjectConfig } from "./config";
55
import type { WorkspaceSelection } from "./components/ProjectSidebar";
@@ -34,66 +34,6 @@ import { useTelemetry } from "./hooks/useTelemetry";
3434

3535
const THINKING_LEVELS: ThinkingLevel[] = ["off", "low", "medium", "high"];
3636

37-
38-
// Styled Components
39-
const AppContainer = styled.div`
40-
display: flex;
41-
height: 100vh;
42-
overflow: hidden;
43-
background: #1e1e1e;
44-
45-
/* Mobile: Ensure content takes full width */
46-
@media (max-width: 768px) {
47-
flex-direction: column;
48-
}
49-
`;
50-
51-
const MainContent = styled.div`
52-
flex: 1;
53-
display: flex;
54-
flex-direction: column;
55-
overflow: hidden;
56-
min-width: 0; /* Allow content to shrink below its minimum content size */
57-
58-
/* Mobile: Take full width */
59-
@media (max-width: 768px) {
60-
width: 100%;
61-
}
62-
`;
63-
64-
const ContentArea = styled.div`
65-
flex: 1;
66-
display: flex;
67-
overflow: hidden;
68-
69-
/* Mobile: Stack content vertically if needed */
70-
@media (max-width: 768px) {
71-
flex-direction: column;
72-
}
73-
`;
74-
75-
const WelcomeView = styled.div`
76-
text-align: center;
77-
padding: clamp(40px, 10vh, 100px) 20px;
78-
max-width: 800px;
79-
margin: 0 auto;
80-
width: 100%;
81-
82-
h2 {
83-
color: #fff;
84-
font-size: clamp(24px, 5vw, 36px);
85-
margin-bottom: 16px;
86-
font-weight: 700;
87-
letter-spacing: -1px;
88-
}
89-
90-
p {
91-
color: #888;
92-
font-size: clamp(14px, 2vw, 16px);
93-
line-height: 1.6;
94-
}
95-
`;
96-
9737
function AppInner() {
9838
const [selectedWorkspace, setSelectedWorkspace] = usePersistedState<WorkspaceSelection | null>(
9939
"selectedWorkspace",
@@ -723,7 +663,7 @@ function AppInner() {
723663

724664
return (
725665
<>
726-
<AppContainer>
666+
<div className="flex h-screen overflow-hidden bg-[#1e1e1e] [@media(max-width:768px)]:flex-col">
727667
<LeftSidebar
728668
projects={projects}
729669
workspaceMetadata={workspaceMetadata}
@@ -743,8 +683,8 @@ function AppInner() {
743683
sortedWorkspacesByProject={sortedWorkspacesByProject}
744684
workspaceRecency={workspaceRecency}
745685
/>
746-
<MainContent>
747-
<ContentArea>
686+
<div className="flex-1 flex flex-col overflow-hidden min-w-0 [@media(max-width:768px)]:w-full">
687+
<div className="flex-1 flex overflow-hidden [@media(max-width:768px)]:flex-col">
748688
{selectedWorkspace ? (
749689
<ErrorBoundary
750690
workspaceInfo={`${selectedWorkspace.projectName}/${selectedWorkspace.namedWorkspacePath?.split("/").pop() ?? selectedWorkspace.workspaceId}`}
@@ -761,13 +701,13 @@ function AppInner() {
761701
/>
762702
</ErrorBoundary>
763703
) : (
764-
<WelcomeView>
765-
<h2>Welcome to Cmux</h2>
704+
<div className="text-center max-w-[800px] mx-auto w-full [&_h2]:text-white [&_h2]:mb-4 [&_h2]:font-bold [&_h2]:tracking-tight [&_p]:text-[#888] [&_p]:leading-[1.6]" style={{ padding: "clamp(40px, 10vh, 100px) 20px", fontSize: "clamp(14px, 2vw, 16px)" }}>
705+
<h2 style={{ fontSize: "clamp(24px, 5vw, 36px)", letterSpacing: "-1px" }}>Welcome to Cmux</h2>
766706
<p>Select a workspace from the sidebar or add a new one to get started.</p>
767-
</WelcomeView>
707+
</div>
768708
)}
769-
</ContentArea>
770-
</MainContent>
709+
</div>
710+
</div>
771711
<CommandPalette
772712
getSlashContext={() => ({
773713
providerNames: [],
@@ -794,7 +734,7 @@ function AppInner() {
794734
/>
795735
)}
796736
<DirectorySelectModal />
797-
</AppContainer>
737+
</div>
798738
</>
799739
);
800740
}

0 commit comments

Comments
Β (0)