Skip to content

Commit

Permalink
fix: clean up ts warnings and errors
Browse files Browse the repository at this point in the history
  • Loading branch information
cmgriffing committed Sep 5, 2023
1 parent 710a472 commit 2602ed8
Show file tree
Hide file tree
Showing 29 changed files with 141 additions and 208 deletions.
33 changes: 8 additions & 25 deletions apps/app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import React, { useEffect, useMemo } from "react";
import {
Outlet,
useNavigate,
useParams,
useSearchParams,
} from "react-router-dom";
import _React, { useEffect, useMemo } from "react";
import { Outlet, useSearchParams } from "react-router-dom";
import { AppShell, Navbar, Header, Flex, Modal, Box } from "@mantine/core";
import { useDisclosure } from "@mantine/hooks";
import { useSnapshot } from "valtio";
Expand Down Expand Up @@ -36,12 +31,9 @@ import { notifications } from "@mantine/notifications";

function App() {
const configSnapshot = useSnapshot(config);
const remoteConfigSnapshot = useSnapshot(remoteConfig);
const remoteMetadataSnapshot = useSnapshot(remoteMetadata);
const [searchParams, setSearchParams] = useSearchParams();
const navigate = useNavigate();

const hasLoggedInParam = searchParams.has("logged_in");
useSnapshot(remoteConfig);
useSnapshot(remoteMetadata);
const [_searchParams, setSearchParams] = useSearchParams();

const [
hostingConfigModalOpened,
Expand All @@ -55,23 +47,14 @@ function App() {
}
}, []);

const {
accessToken,
repositoryName,
owner,
targetBranch,
shouldCreatePullRequest,
branchNamePrefix,
} =
const { accessToken, repositoryName, owner, targetBranch } =
config.hosting.provider === "github"
? config.hosting
: {
accessToken: "",
repositoryName: "",
owner: "",
targetBranch: "",
shouldCreatePullRequest: true,
branchNamePrefix: "",
};

const groups = config.groups;
Expand Down Expand Up @@ -243,8 +226,8 @@ function App() {
if (cleanConfig.hosting.providerType === "git") {
cleanConfig.hosting.accessToken = "";
} else if (cleanConfig.hosting.providerType === "direct") {
cleanConfig.hosting.accessKeyId = "";
cleanConfig.hosting.secretAccessKey = "";
// cleanConfig.hosting.accessKeyId = "";
// cleanConfig.hosting.secretAccessKey = "";
}

cleanConfig.groups = cleanConfig.groups.map((group) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/app/src/components/CustomCard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PropsWithChildren, ReactNode } from "react";
import _React, { PropsWithChildren, ReactNode } from "react";
import { Box, Flex, Text } from "@mantine/core";

import { CustomTooltip } from "./CustomTooltip";
Expand Down
4 changes: 2 additions & 2 deletions apps/app/src/components/CustomList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { ReactNode } from "react";
import { Outlet, Link, NavLink } from "react-router-dom";
import _React, { ReactNode } from "react";
import { Link } from "react-router-dom";
import {
Flex,
ActionIcon,
Expand Down
2 changes: 1 addition & 1 deletion apps/app/src/components/CustomNumberInput.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useMemo } from "react";
import _React, { useMemo } from "react";
import { Input, NumberInput } from "@mantine/core";
import { VexillaNumberType } from "@vexilla/types";

Expand Down
2 changes: 1 addition & 1 deletion apps/app/src/components/CustomSlider.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useRef } from "react";
import _React, { useRef } from "react";
import { Slider, Flex, NumberInput, Button, Text } from "@mantine/core";

import { nanoid } from "../utils/nanoid";
Expand Down
2 changes: 1 addition & 1 deletion apps/app/src/components/CustomTooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import _React from "react";
import { ActionIcon, Tooltip } from "@mantine/core";

import Icon from "@iconify/react";
Expand Down
3 changes: 1 addition & 2 deletions apps/app/src/components/PageLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Box } from "@mantine/core";
import React, { PropsWithChildren } from "react";
import _React, { PropsWithChildren } from "react";

export function PageLayout({
children,
Expand Down
8 changes: 4 additions & 4 deletions apps/app/src/components/Status.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PropsWithChildren, useState } from "react";
import _React, { PropsWithChildren, useState } from "react";
import { useSnapshot } from "valtio";
import { Difference } from "microdiff";
import {
Expand Down Expand Up @@ -63,9 +63,9 @@ export function Status({
mergeRemoteConfig,
}: StatusProps) {
const validationSnapshot = useSnapshot(validation);
const localDifferencesSnapshot = useSnapshot(localDifferences);
const remoteDifferencesSnapshot = useSnapshot(remoteDifferences);
const remoteMetadataSnapshot = useSnapshot(remoteMetadata);
useSnapshot(localDifferences);
useSnapshot(remoteDifferences);
useSnapshot(remoteMetadata);

const [
remoteChangesModalOpened,
Expand Down
2 changes: 1 addition & 1 deletion apps/app/src/components/TimelineItemTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import _React from "react";
import { Flex } from "@mantine/core";

import { CustomTooltip } from "./CustomTooltip";
Expand Down
8 changes: 4 additions & 4 deletions apps/app/src/components/app/OnboardingForm.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from "react";
import { Select, Flex, Switch } from "@mantine/core";
import _React, { useState } from "react";
import { Select, Flex } from "@mantine/core";
import { AppState } from "@vexilla/types";
import { snapshot, useSnapshot } from "valtio";
import { useSnapshot } from "valtio";
import { EmptyForm } from "./forms/_EmptyForm";
import { GithubForm } from "./forms/GithubForm";
import { HostingProvider, HostingProviderType } from "@vexilla/hosts";
Expand Down Expand Up @@ -68,7 +68,7 @@ export function OnboardingForm({
updateProvider,
}: OnboardingFormProps) {
const configSnapshot = useSnapshot(config);
const [providerType, setProviderType] = useState(
const [_providerType, setProviderType] = useState(
configSnapshot?.hosting?.providerType
);

Expand Down
19 changes: 4 additions & 15 deletions apps/app/src/components/app/forms/GithubForm.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
import React, { useEffect, useState, useCallback, useMemo } from "react";
import {
Button,
Timeline,
Select,
ActionIcon,
Flex,
Tooltip,
} from "@mantine/core";
import _React, { useEffect, useState, useMemo } from "react";
import { Button, Timeline, Select, ActionIcon, Flex } from "@mantine/core";
import { cloneDeep } from "lodash-es";

import { AppState } from "@vexilla/types";

import { Branch, Repository } from "./_GitForm.types";
import { GitHubFetcher } from "./GithubForm.fetchers";
import {
GitHubBranch,
GitHubInstallation,
GitHubRepository,
} from "./GithubForm.types";
import { GitHubInstallation } from "./GithubForm.types";

import { GitForm } from "./_GitForm";
import { TimelineItemTitle } from "../../TimelineItemTitle";
Expand Down Expand Up @@ -57,7 +46,7 @@ const disabledButtonStyling = {
maxWidth: "calc(100% - 28px - 0.25rem)",
};

export function GithubForm({ config, updateConfig }: GithubFormProps) {
export function GithubForm({ config }: GithubFormProps) {
const configSnapshot = useSnapshot(config);
const {
accessToken,
Expand Down
10 changes: 5 additions & 5 deletions apps/app/src/components/app/forms/GithubForm.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -853,11 +853,11 @@ export interface GitHubApp {
* The set of permissions for the GitHub app
*/
permissions: {
issues?: string;
checks?: string;
metadata?: string;
contents?: string;
deployments?: string;
issues: string;
checks: string;
metadata: string;
contents: string;
deployments: string;
[k: string]: string;
};
/**
Expand Down
152 changes: 76 additions & 76 deletions apps/app/src/components/app/forms/S3Form.tsx
Original file line number Diff line number Diff line change
@@ -1,86 +1,86 @@
import React from "react";
import { Button } from "@mantine/core";
import { AppState } from "@vexilla/types";
// import _React from "react";
// import { Button } from "@mantine/core";
// import { AppState } from "@vexilla/types";

import { GithubLogo } from "../../logos/GithubLogo";
// import { GithubLogo } from "../../logos/GithubLogo";

import { Icon } from "@iconify/react";
import verifiedCheckBold from "@iconify/icons-solar/verified-check-bold";
// import { Icon } from "@iconify/react";
// import verifiedCheckBold from "@iconify/icons-solar/verified-check-bold";

const githubAppName = `vexilla-dev`;
// const githubAppName = `vexilla`;
// const githubAppName = `vexilla-dev`;
// // const githubAppName = `vexilla`;

interface S3FormProps {
config: AppState;
}
// interface S3FormProps {
// config: AppState;
// }

const buttonStyling = { backgroundColor: "black", color: "white" };
const disabledButtonStyling = {
backgroundColor: "black",
color: "white",
opacity: 0.6,
};
// const buttonStyling = { backgroundColor: "black", color: "white" };
// const disabledButtonStyling = {
// backgroundColor: "black",
// color: "white",
// opacity: 0.6,
// };

export function GithubForm({ config }: S3FormProps) {
return (
<div>
<h2>Installation</h2>
<p>The app must be installed into a repo via the Github marketplace.</p>
{!config.hosting?.config.installationId && (
<Button
style={buttonStyling}
leftIcon={<GithubLogo />}
onClick={() => {
window.location.href = `https://github.com/apps/${githubAppName}/installations/new`;
}}
>
Install
</Button>
)}
// export function GithubForm({ config }: S3FormProps) {
// return (
// <div>
// <h2>Installation</h2>
// <p>The app must be installed into a repo via the Github marketplace.</p>
// {!config.hosting?.config.installationId && (
// <Button
// style={buttonStyling}
// leftIcon={<GithubLogo />}
// onClick={() => {
// window.location.href = `https://github.com/apps/${githubAppName}/installations/new`;
// }}
// >
// Install
// </Button>
// )}

{!!config.hosting?.config.installationId && (
<Button
variant="outline"
style={disabledButtonStyling}
leftIcon={<GithubLogo />}
rightIcon={<Icon width={20} icon={verifiedCheckBold} color="green" />}
disabled
>
Installed
</Button>
)}
// {!!config.hosting?.config.installationId && (
// <Button
// variant="outline"
// style={disabledButtonStyling}
// leftIcon={<GithubLogo />}
// rightIcon={<Icon width={20} icon={verifiedCheckBold} color="green" />}
// disabled
// >
// Installed
// </Button>
// )}

<h2>Login</h2>
<p>
You need to login via Github so that the app can make PRs on your
behalf.
</p>
// <h2>Login</h2>
// <p>
// You need to login via Github so that the app can make PRs on your
// behalf.
// </p>

{!config.hosting?.config.accessToken && (
<Button
style={buttonStyling}
leftIcon={<GithubLogo />}
onClick={() => {
window.location.href = `https://github.com/login/oauth/authorize?client_id=${githubClientId}&redirect_uri=${encodeURIComponent(
`${baseAuthCallbackUrl}/github`
)}`;
}}
>
Login
</Button>
)}
// {!config.hosting?.config.accessToken && (
// <Button
// style={buttonStyling}
// leftIcon={<GithubLogo />}
// onClick={() => {
// window.location.href = `https://github.com/login/oauth/authorize?client_id=${githubClientId}&redirect_uri=${encodeURIComponent(
// `${baseAuthCallbackUrl}/github`
// )}`;
// }}
// >
// Login
// </Button>
// )}

{!!config.hosting?.config.accessToken && (
<Button
style={disabledButtonStyling}
variant="outline"
leftIcon={<GithubLogo />}
rightIcon={<Icon width={20} icon={verifiedCheckBold} color="green" />}
disabled
>
Logged in
</Button>
)}
</div>
);
}
// {!!config.hosting?.config.accessToken && (
// <Button
// style={disabledButtonStyling}
// variant="outline"
// leftIcon={<GithubLogo />}
// rightIcon={<Icon width={20} icon={verifiedCheckBold} color="green" />}
// disabled
// >
// Logged in
// </Button>
// )}
// </div>
// );
// }
4 changes: 2 additions & 2 deletions apps/app/src/components/app/forms/_EmptyForm.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from "react";
import _React from "react";
import { AppState } from "@vexilla/types";

interface EmptyFormProps {
config: AppState;
}

export function EmptyForm({ config }: EmptyFormProps) {
export function EmptyForm({}: EmptyFormProps) {
return <div>Empty Form</div>;
}
4 changes: 1 addition & 3 deletions apps/app/src/components/app/forms/_GitForm.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PropsWithChildren } from "react";
import _React, { PropsWithChildren } from "react";
import {
Timeline,
Select,
Expand Down Expand Up @@ -26,8 +26,6 @@ const githubAppName = `vexilla-dev`;

export function GitForm({
config,
updateConfig,
totalElements,
activeElement,
children,
repositories,
Expand Down

0 comments on commit 2602ed8

Please sign in to comment.