Skip to content

Commit

Permalink
feat(slice-machine): add GitHub settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
bapmrl committed Jan 31, 2024
1 parent c4705c8 commit fe9d3e5
Show file tree
Hide file tree
Showing 17 changed files with 1,286 additions and 70 deletions.
2 changes: 2 additions & 0 deletions packages/manager/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export { createSliceMachineManager } from "./managers/createSliceMachineManager"
export { createSliceMachineManagerMiddleware } from "./managers/createSliceMachineManagerMiddleware";
export type { CreateSliceMachineManagerMiddlewareArgs } from "./managers/createSliceMachineManagerMiddleware";

export type { GitOwner, GitRepo, GitRepoSpecifier } from "./managers/git/types";

export type {
Environment,
PushChangesLimit,
Expand Down
4 changes: 2 additions & 2 deletions packages/manager/src/managers/git/GitManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import {

import { BaseManager } from "../BaseManager";

import { GitRepo, GitRepoSpecifier, Owner } from "./types";
import { GitOwner, GitRepo, GitRepoSpecifier } from "./types";
import { buildGitRepoSpecifier } from "./buildGitRepoSpecifier";

type GitManagerCreateGitHubAuthStateReturnType = {
key: string;
expiresAt: Date;
};

type GitManagerFetchOwnersReturnType = Owner[];
type GitManagerFetchOwnersReturnType = GitOwner[];

type GitManagerFetchReposReturnType = GitRepo[];

Expand Down
2 changes: 1 addition & 1 deletion packages/manager/src/managers/git/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type Owner = {
export type GitOwner = {
provider: "gitHub";
id: string;
name: string;
Expand Down
25 changes: 13 additions & 12 deletions packages/slice-machine/components/Navigation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { telemetry } from "@src/apiClient";
import VideoItem from "@components/Navigation/VideoItem";
import { LightningIcon } from "@src/icons/Lightning";
import { MathPlusIcon } from "@src/icons/MathPlusIcon";
import { SettingsIcon } from "@src/icons/SettingsIcon";
import { CUSTOM_TYPES_CONFIG } from "@src/features/customTypes/customTypesConfig";
import {
SideNavSeparator,
Expand Down Expand Up @@ -141,21 +142,11 @@ const Navigation: FC = () => {
)}

<SideNavList position="bottom">
<SideNavListItem>
<SideNavLink
title="Settings"
href="/settings"
Icon={(props) => <MathPlusIcon {...props} />}
active={router.asPath.startsWith("/settings")}
component={Link}
/>
</SideNavListItem>

<SideNavListItem>
<SideNavLink
title="Invite team"
href={`${repositoryUrl}/settings/users`}
Icon={(props) => <MathPlusIcon {...props} />}
Icon={MathPlusIcon}
onClick={() => {
void telemetry.track({
event: "users-invite-button-clicked",
Expand All @@ -174,11 +165,21 @@ const Navigation: FC = () => {
</Suspense>
</ErrorBoundary>

<SideNavListItem>
<SideNavLink
title="Settings"
href="/settings"
Icon={SettingsIcon}
active={router.asPath.startsWith("/settings")}
component={Link}
/>
</SideNavListItem>

<SideNavListItem>
<SideNavLink
title="Changelog"
href="/changelog"
Icon={(props) => <LightningIcon {...props} />}
Icon={LightningIcon}
active={router.asPath.startsWith("/changelog")}
component={Link}
RightElement={
Expand Down
3 changes: 3 additions & 0 deletions packages/slice-machine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@
"next-router-mock": "0.8.0",
"node-fetch": "3.3.1",
"parse-multipart-data": "1.5.0",
"postcss": "8.4.21",
"postcss-flexbugs-fixes": "5.0.2",
"postcss-preset-env": "9.3.0",
"rc-drawer": "4.4.3",
"react": "18.2.0",
"react-beautiful-dnd": "13.1.1",
Expand Down
33 changes: 1 addition & 32 deletions packages/slice-machine/pages/settings.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1 @@
import React from "react";
import Head from "next/head";
import { BaseStyles } from "theme-ui";
import {
AppLayout,
AppLayoutBreadcrumb,
AppLayoutContent,
AppLayoutHeader,
} from "@components/AppLayout";
import { ConnectGitRepository } from "@src/features/git/ConnectGitRepository/ConnectGitRepository";

const Settings: React.FC = () => {
return (
<>
<Head>
<title>Settings - Slice Machine</title>
</Head>
<AppLayout>
<AppLayoutHeader>
<AppLayoutBreadcrumb folder="Settings" />
</AppLayoutHeader>
<AppLayoutContent>
<BaseStyles sx={{ display: "flex", flexDirection: "column" }}>
<ConnectGitRepository />
</BaseStyles>
</AppLayoutContent>
</AppLayout>
</>
);
};

export default Settings;
export { SettingsPage as default } from "@src/features/settings/SettingsPage";
10 changes: 10 additions & 0 deletions packages/slice-machine/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
plugins: {
"postcss-flexbugs-fixes": true,
"postcss-preset-env": {
autoprefixer: { flexbox: "no-2009" },
features: { "custom-properties": false, "nesting-rules": true },
stage: 3,
},
},
};
31 changes: 20 additions & 11 deletions packages/slice-machine/src/components/FieldSet/FieldSet.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,14 @@ export const WithHeaderAndBoxContent = {
<OwnerSelect />
</FieldSetHeader>
<FieldSetContent>
{/*
* TODO: these `padding` values actually don't match Figma, but they
* are the closest allowed by the `Box` component.
*/}
<Box flexDirection="column" padding={{ block: 72, inline: 100 }}>
<Box
flexDirection="column"
/*
* TODO: these `padding` values actually don't match Figma, but they
* are the closest allowed by the `Box` component.
*/
padding={{ block: 72, inline: 100 }}
>
<Text align="center" variant="emphasized">
No Results Found
</Text>
Expand Down Expand Up @@ -230,12 +233,18 @@ function OwnerSelect(props: OwnerSelectProps) {
size="large"
sx={{ width: "calc(50% - 8px)" }}
>
<SelectItem size="large" value="owner-1">
Owner
</SelectItem>
<SelectItem size="large" value="owner-2">
Owner
</SelectItem>
{[...Array(2).keys()].map((index) => (
<SelectItem
key={index}
renderStartIcon={() => (
<GitHubIcon color={tokens.color.greyLight11} />
)}
size="large"
value={`owner-${index}`}
>
Owner
</SelectItem>
))}
</Select>
);
}
29 changes: 29 additions & 0 deletions packages/slice-machine/src/features/settings/SettingsPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Box } from "@prismicio/editor-ui";
import Head from "next/head";
import type { FC } from "react";

import {
AppLayout,
AppLayoutBreadcrumb,
AppLayoutContent,
AppLayoutHeader,
} from "@components/AppLayout";
import { ConnectGitRepository } from "@src/features/settings/git/ConnectGitRepository";

export const SettingsPage: FC = () => (
<>
<Head>
<title>Settings - Slice Machine</title>
</Head>
<AppLayout>
<AppLayoutHeader>
<AppLayoutBreadcrumb folder="Settings" />
</AppLayoutHeader>
<AppLayoutContent>
<Box flexDirection="column" maxWidth={600}>
<ConnectGitRepository />
</Box>
</AppLayoutContent>
</AppLayout>
</>
);
Loading

0 comments on commit fe9d3e5

Please sign in to comment.