Skip to content

Commit 9d9094f

Browse files
committed
Fix org step spacing and project dropdown theming
1 parent f854520 commit 9d9094f

1 file changed

Lines changed: 92 additions & 71 deletions

File tree

  • apps/code/src/renderer/features/onboarding/components

apps/code/src/renderer/features/onboarding/components/OrgStep.tsx

Lines changed: 92 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,20 @@ import { useOnboardingStore } from "@features/onboarding/stores/onboardingStore"
88
import { useProjects } from "@features/projects/hooks/useProjects";
99
import { useOrganizations } from "@hooks/useOrganizations";
1010
import { ArrowLeft, ArrowRight, CheckCircle } from "@phosphor-icons/react";
11-
import { Box, Button, Callout, Flex, Skeleton, Text } from "@radix-ui/themes";
11+
import {
12+
Box,
13+
Button,
14+
Callout,
15+
Flex,
16+
Select,
17+
Skeleton,
18+
Text,
19+
} from "@radix-ui/themes";
1220
import codeLogo from "@renderer/assets/images/code.svg";
1321
import { useMutation, useQueryClient } from "@tanstack/react-query";
1422
import { logger } from "@utils/logger";
1523
import { AnimatePresence, motion } from "framer-motion";
1624
import { useMemo } from "react";
17-
import { ProjectSelect } from "./ProjectSelect";
1825

1926
const log = logger.scope("org-step");
2027

@@ -61,11 +68,6 @@ export function OrgStep({ onNext, onBack }: OrgStepProps) {
6168
return currentProjectId ?? projects[0]?.id ?? null;
6269
}, [manuallySelectedProjectId, currentProjectId, projects]);
6370

64-
const selectedProject = useMemo(
65-
() => projects.find((p) => p.id === selectedProjectId),
66-
[projects, selectedProjectId],
67-
);
68-
6971
const handleContinue = async () => {
7072
if (!effectiveSelectedOrgId) return;
7173

@@ -84,7 +86,7 @@ export function OrgStep({ onNext, onBack }: OrgStepProps) {
8486
onNext();
8587
};
8688

87-
const handleSelect = (orgId: string) => {
89+
const handleSelectOrg = (orgId: string) => {
8890
selectOrg(orgId);
8991
setSelectedProjectId(null);
9092
};
@@ -101,7 +103,7 @@ export function OrgStep({ onNext, onBack }: OrgStepProps) {
101103
paddingBottom: 40,
102104
}}
103105
>
104-
<Flex direction="column" gap="3" mb="6">
106+
<Flex direction="column" gap="3" mb="4">
105107
<img
106108
src={codeLogo}
107109
alt="PostHog"
@@ -144,80 +146,99 @@ export function OrgStep({ onNext, onBack }: OrgStepProps) {
144146
marginBottom: "var(--space-6)",
145147
}}
146148
>
147-
<AnimatePresence mode="wait">
148-
{isLoading ? (
149-
<motion.div
150-
key="skeleton"
151-
initial={{ opacity: 0 }}
152-
animate={{ opacity: 1 }}
153-
exit={{ opacity: 0 }}
154-
transition={{ duration: 0.15 }}
155-
>
156-
<Flex direction="column" gap="3">
157-
<Flex
158-
align="center"
159-
justify="between"
160-
gap="3"
161-
px="4"
162-
py="3"
163-
style={{
164-
backgroundColor: "var(--color-panel-solid)",
165-
border: "2px solid var(--gray-4)",
166-
}}
167-
>
168-
<Flex align="center" gap="3">
169-
<Skeleton style={{ width: "140px", height: "20px" }} />
170-
</Flex>
171-
<Skeleton
149+
<Flex direction="column" gap="2">
150+
<Text size="2" weight="medium" style={{ color: "var(--gray-12)" }}>
151+
Organization
152+
</Text>
153+
<AnimatePresence mode="wait">
154+
{isLoading ? (
155+
<motion.div
156+
key="skeleton"
157+
initial={{ opacity: 0 }}
158+
animate={{ opacity: 1 }}
159+
exit={{ opacity: 0 }}
160+
transition={{ duration: 0.15 }}
161+
>
162+
<Flex direction="column" gap="3">
163+
<Flex
164+
align="center"
165+
justify="between"
166+
gap="3"
167+
px="4"
168+
py="3"
172169
style={{
173-
width: "16px",
174-
height: "16px",
175-
borderRadius: "50%",
170+
backgroundColor: "var(--color-panel-solid)",
171+
border: "2px solid var(--gray-4)",
176172
}}
177-
/>
173+
>
174+
<Flex align="center" gap="3">
175+
<Skeleton style={{ width: "140px", height: "20px" }} />
176+
</Flex>
177+
<Skeleton
178+
style={{
179+
width: "16px",
180+
height: "16px",
181+
borderRadius: "50%",
182+
}}
183+
/>
184+
</Flex>
178185
</Flex>
179-
</Flex>
180-
</motion.div>
181-
) : (
182-
<motion.div
183-
key="content"
184-
initial={{ opacity: 0 }}
185-
animate={{ opacity: 1 }}
186-
transition={{ duration: 0.2 }}
187-
>
188-
<Flex direction="column" gap="3">
189-
{orgs.map((org) => (
190-
<OrgCard
191-
key={org.id}
192-
name={org.name}
193-
isSelected={effectiveSelectedOrgId === org.id}
194-
onSelect={() => handleSelect(org.id)}
195-
/>
196-
))}
197-
</Flex>
198-
</motion.div>
199-
)}
200-
</AnimatePresence>
186+
</motion.div>
187+
) : (
188+
<motion.div
189+
key="content"
190+
initial={{ opacity: 0 }}
191+
animate={{ opacity: 1 }}
192+
transition={{ duration: 0.2 }}
193+
>
194+
<Flex direction="column" gap="2">
195+
{orgs.map((org) => (
196+
<OrgCard
197+
key={org.id}
198+
name={org.name}
199+
isSelected={effectiveSelectedOrgId === org.id}
200+
onSelect={() => handleSelectOrg(org.id)}
201+
/>
202+
))}
203+
</Flex>
204+
</motion.div>
205+
)}
206+
</AnimatePresence>
207+
</Flex>
201208

202-
{!isLoading && !hasOrgChanged && selectedProject && (
203-
<Flex direction="column" gap="1" mt="5">
209+
{!isLoading && !hasOrgChanged && projects.length > 0 && (
210+
<Flex direction="column" gap="2" mt="4">
204211
<Text
205212
size="2"
206213
weight="medium"
207214
style={{ color: "var(--gray-12)" }}
208215
>
209216
Project
210217
</Text>
211-
<ProjectSelect
212-
projectId={selectedProject.id}
213-
projectName={selectedProject.name}
214-
projects={projects.map((p) => ({
215-
id: p.id,
216-
name: p.name,
217-
}))}
218-
onProjectChange={setSelectedProjectId}
218+
<Select.Root
219+
value={
220+
selectedProjectId !== null
221+
? String(selectedProjectId)
222+
: undefined
223+
}
224+
onValueChange={(value) => setSelectedProjectId(Number(value))}
225+
size="2"
219226
disabled={projectsLoading}
220-
/>
227+
>
228+
<Select.Trigger
229+
placeholder="Select a project..."
230+
color="gray"
231+
variant="surface"
232+
style={{ width: "100%" }}
233+
/>
234+
<Select.Content color="gray">
235+
{projects.map((project) => (
236+
<Select.Item key={project.id} value={String(project.id)}>
237+
{project.name}
238+
</Select.Item>
239+
))}
240+
</Select.Content>
241+
</Select.Root>
221242
</Flex>
222243
)}
223244
</Box>

0 commit comments

Comments
 (0)