Skip to content

Commit

Permalink
feat: finalize Summary section shape
Browse files Browse the repository at this point in the history
  • Loading branch information
antoine-coulon committed Jul 19, 2023
1 parent 086453d commit 07edf3c
Show file tree
Hide file tree
Showing 7 changed files with 484 additions and 88 deletions.
2 changes: 1 addition & 1 deletion apps/web/src/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import App from "./App.tsx";

function Root() {
const [colorScheme, setColorScheme] = React.useState<"light" | "dark">(
"light"
"dark"
);
const toggleColorScheme = () =>
setColorScheme((scheme) => (scheme === "dark" ? "light" : "dark"));
Expand Down
27 changes: 25 additions & 2 deletions apps/web/src/fake-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,31 @@ export const graphDataWithCycles = {
adjacentTo: [],
body: {
size: 1380,
thirdPartyDependencies: [],
builtinDependencies: [],
thirdPartyDependencies: [
"rxjs",
"fastify",
"@azure/keyvault-secrets",
"@azure/identity",
"@azure/core-http",
],
builtinDependencies: [
"node:child_process",
"node:ffi",
"node:path",
"node:process",
"node:module",
"node:util",
"node:fs",
"node:os",
"node:events",
"node:stream",
"node:net",
"node:tls",
"node:crypto",
"node:assert",
"node:zlib",
"node:dns",
],
},
},
"src/core/primary_adapters/index.ts": {
Expand Down
59 changes: 47 additions & 12 deletions apps/web/src/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,18 @@ import {
Header as MantineHeader,
Image,
useMantineColorScheme,
Flex,
Title,
ThemeIcon,
Box,
Paper,
} from "@mantine/core";
import { IconMoonStars, IconSun } from "@tabler/icons-react";
import { IconBrandGithub, IconMoonStars, IconSun } from "@tabler/icons-react";

const metadata = {
name: "skott",
version: "0.28.0",
};

export default function Header() {
const { colorScheme, toggleColorScheme } = useMantineColorScheme();
Expand All @@ -17,17 +27,42 @@ export default function Header() {
<Image src={"./skott.svg"} width={125} fit="contain" radius="md" />
</Group>

<ActionIcon
variant="default"
onClick={() => toggleColorScheme()}
size={30}
>
{colorScheme === "dark" ? (
<IconSun size={16} />
) : (
<IconMoonStars size={16} />
)}
</ActionIcon>
<Paper withBorder p={5}>
<Flex justify="space-between" align="center" direction="row">
<Title size="sm" color="blue">
{metadata.name}
</Title>
<Title size="sm" color="dimmed">
@
</Title>
<Title size="sm" color="grape">
{metadata.version}
</Title>
</Flex>
</Paper>

<Group position="apart">
<ActionIcon
variant="default"
onClick={() => toggleColorScheme()}
size={30}
>
<ThemeIcon color="dark">
<IconBrandGithub />
</ThemeIcon>
</ActionIcon>
<ActionIcon
variant="default"
onClick={() => toggleColorScheme()}
size={30}
>
{colorScheme === "dark" ? (
<IconSun size={16} />
) : (
<IconMoonStars size={16} />
)}
</ActionIcon>
</Group>
</Group>
</MantineHeader>
);
Expand Down
206 changes: 205 additions & 1 deletion apps/web/src/sidebar/FileExplorer.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,207 @@
import {
Navbar,
Group,
Tooltip,
TextInput,
Code,
ThemeIcon,
Text,
ScrollArea,
createStyles,
rem,
Checkbox,
Title,
Accordion,
} from "@mantine/core";
import {
IconSearch,
IconBrandTypescript,
IconBrandJavascript,
} from "@tabler/icons-react";

import { fakeSkottData } from "../fake-data";
import { isJavaScriptModule, isTypeScriptModule } from "../util.js";

const data = fakeSkottData;

const useStyles = createStyles((theme) => ({
searchCode: {
fontWeight: 700,
fontSize: rem(10),
backgroundColor:
theme.colorScheme === "dark"
? theme.colors.dark[7]
: theme.colors.gray[0],
border: `${rem(1)} solid ${
theme.colorScheme === "dark" ? theme.colors.dark[7] : theme.colors.gray[2]
}`,
},

mainLinks: {
paddingLeft: `calc(${theme.spacing.md} - ${theme.spacing.xs})`,
paddingRight: `calc(${theme.spacing.md} - ${theme.spacing.xs})`,
paddingBottom: theme.spacing.md,
},

mainLink: {
display: "flex",
alignItems: "center",
width: "100%",
fontSize: theme.fontSizes.xs,
padding: `${rem(8)} ${theme.spacing.xs}`,
borderRadius: theme.radius.sm,
fontWeight: 500,
color:
theme.colorScheme === "dark"
? theme.colors.dark[0]
: theme.colors.gray[7],

"&:hover": {
backgroundColor:
theme.colorScheme === "dark"
? theme.colors.dark[6]
: theme.colors.gray[0],
color: theme.colorScheme === "dark" ? theme.white : theme.black,
},
},

mainLinkInner: {
display: "flex",
alignItems: "center",
flex: 1,
},

mainLinkIcon: {
marginRight: theme.spacing.sm,
color:
theme.colorScheme === "dark"
? theme.colors.dark[2]
: theme.colors.gray[6],
},

mainLinkBadge: {
padding: 0,
width: rem(20),
height: rem(20),
pointerEvents: "none",
},

collections: {
paddingLeft: `calc(${theme.spacing.md} - ${rem(6)})`,
paddingRight: `calc(${theme.spacing.md} - ${rem(6)})`,
paddingBottom: theme.spacing.md,
},

collectionsHeader: {
paddingLeft: `calc(${theme.spacing.md} + ${rem(2)})`,
paddingRight: theme.spacing.md,
marginBottom: rem(5),
},

collectionLink: {
display: "block",
padding: `${rem(8)} ${theme.spacing.xs}`,
textDecoration: "none",
borderRadius: theme.radius.sm,
fontSize: theme.fontSizes.xs,
color:
theme.colorScheme === "dark"
? theme.colors.dark[0]
: theme.colors.gray[7],
lineHeight: 1,
fontWeight: 500,

"&:hover": {
backgroundColor:
theme.colorScheme === "dark"
? theme.colors.dark[6]
: theme.colors.gray[0],
color: theme.colorScheme === "dark" ? theme.white : theme.black,
},
},
}));

export function FileExplorer() {
return <div>file_explorer</div>;
const { classes } = useStyles();

const builtinRegistry = new Set<string>();
const npmRegistry = new Set<string>();
const typescriptFiles: string[] = [];
const javascriptFiles: string[] = [];

for (const file of data.files) {
if (isTypeScriptModule(file)) {
typescriptFiles.push(file);
}

if (isJavaScriptModule(file)) {
javascriptFiles.push(file);
}
}

for (const node of Object.values(data.graph)) {
node.body.thirdPartyDependencies.forEach((dep) => {
npmRegistry.add(dep);
});
node.body.builtinDependencies.forEach((dep) => {
builtinRegistry.add(dep);
});
}

return (
<Navbar.Section p="md">
<TextInput
placeholder="Search"
size="xs"
icon={<IconSearch size="0.8rem" stroke={1.5} />}
rightSectionWidth={70}
rightSection={<Code className={classes.searchCode}>CMD + K</Code>}
styles={{ rightSection: { pointerEvents: "none" } }}
mb="sm"
/>

<Accordion variant="default">
<Accordion.Item value="js" pt="sm">
<Accordion.Control
icon={
<ThemeIcon color="#f0dc4e" size={24} radius="xl">
<IconBrandJavascript size={rem(20)} color="black" />
</ThemeIcon>
}
/>
<Accordion.Panel>
<ScrollArea.Autosize mah={250} mx="auto">
<Group position="apart" mt="xs" mr="md">
<Text truncate>lmao.js</Text>
<Checkbox />
</Group>
<Group position="apart" mt="xs" mr="md">
<Tooltip.Floating
label="src/lib/some-dir/some-folder/index.js"
position="top"
>
<Text
lineClamp={1}
style={{
maxWidth: "calc(100% - 40px)",
}}
>
src/lib/some-dir/index.js
</Text>
</Tooltip.Floating>
<Checkbox />
</Group>
</ScrollArea.Autosize>
</Accordion.Panel>
</Accordion.Item>

<Accordion.Item value="ts">
<Accordion.Control
icon={<IconBrandTypescript size={rem(20)} color="#007acc" />}
></Accordion.Control>
<Accordion.Panel>Content</Accordion.Panel>
</Accordion.Item>
</Accordion>
</Navbar.Section>
);
}
Loading

0 comments on commit 07edf3c

Please sign in to comment.