Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup: remove unused constants, utils, hooks & components #1490

Merged
merged 7 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
167 changes: 0 additions & 167 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
"clsx": "^2.1.1",
"color": "^4.2.3",
"colorthief": "^2.3.2",
"embla-carousel-autoplay": "^8.1.6",
"embla-carousel-react": "^8.1.6",
"events": "^3.3.0",
"framer-motion": "^7.10.3",
Expand Down Expand Up @@ -112,7 +111,6 @@
"react-hook-form": "7.43.9",
"react-live-chat-loader": "^2.9.1",
"react-markdown": "^8.0.7",
"react-papaparse": "^4.4.0",
"react-window": "^1.8.8",
"remark-gfm": "^4.0.0",
"slugify": "^1.6.5",
Expand Down Expand Up @@ -156,9 +154,6 @@
"husky": "^8.0.3",
"lint-staged": "^13.0.0",
"postcss": "^8.4.38",
"prettier": "^3.3.2",
"prettier-plugin-jsdoc": "^1.3.0",
"prettier-plugin-tailwindcss": "^0.6.5",
"storybook": "^8.1.11",
"tailwindcss": "^3.4.4",
"typescript": "^5.5.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const generateExponentialArray = (
return Array.from({ length: steps }, (_, i) => Math.pow(exponent, i) * scaleFactor)
}

export const calculateXpProgression = ({
const calculateXpProgression = ({
experienceCount,
}: { experienceCount: number }) => {
if (MAX_LEVEL < 1) throw new Error(`max level must be positive`)
Expand Down
2 changes: 0 additions & 2 deletions src/app/explorer/_components/YourGuilds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,3 @@ export const YourGuilds = () => {
</section>
)
}

export { useYourGuilds }
3 changes: 1 addition & 2 deletions src/app/oauth/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

import { usePostHogContext } from "@/components/Providers/PostHogProvider"
import { useErrorToast } from "@/components/ui/hooks/useErrorToast"
import type { Message } from "@/hooks/useOauthPopupWindow"
import { PlatformName } from "@guildxyz/types"
import { useRouter } from "next/navigation"
import { useCallback, useEffect } from "react"
import timeoutPromise from "utils/timeoutPromise"
import { OAuthLocalStorageInfo, OAuthResponse } from "./types"
import { Message, OAuthLocalStorageInfo, OAuthResponse } from "./types"

const OAUTH_CONFIRMATION_TIMEOUT_MS = 500

Expand Down
6 changes: 6 additions & 0 deletions src/app/oauth/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { PlatformName } from "@guildxyz/types"
import { OneOf } from "types"

export type OAuthResponse = {
error_description?: string
Expand All @@ -13,3 +14,8 @@ export type OAuthLocalStorageInfo = {
redirect_url: string
scope: string
}

export type Message = OneOf<
{ type: "OAUTH_ERROR"; data: { error: string; errorDescription: string } },
{ type: "OAUTH_SUCCESS"; data: any }
>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { atom, useAtom } from "jotai"
import { useEffect } from "react"

export const isAddRewardPanelDirtyAtom = atom(false)
const isAddRewardPanelDirtyAtom = atom(false)

export const useAddRewardDiscardAlert = (isDirty?: boolean) => {
const [isAddRewardPanelDirty, setIsAddRewardPanelDirty] = useAtom<boolean>(
Expand Down
4 changes: 2 additions & 2 deletions src/components/[guild]/EditGuild/hooks/useEditGuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ type Props = {
guildId?: string | number
}

export const countFailed = (arr: Record<string, string>[]) =>
const countFailed = (arr: Record<string, string>[]) =>
arr.filter((res) => !!res.error).length

export const getCorrelationId = (arr: Record<string, string>[]) =>
const getCorrelationId = (arr: Record<string, string>[]) =>
arr.filter((res) => !!res.error)[0]?.correlationId

const getError = (arr: Record<string, string>[]) =>
Expand Down
1 change: 0 additions & 1 deletion src/components/[guild]/RequirementHandlerContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,5 @@ const ApiRequirementHandlerProvider = ({
export {
ApiRequirementHandlerProvider,
ClientStateRequirementHandlerProvider,
RequirementHandlerContext,
useRequirementHandlerContext,
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import useSubmit from "hooks/useSubmit"
import { useToastWithShareButtons } from "hooks/useToastWithShareButtons"
import { useState } from "react"
import fetcher from "utils/fetcher"
import parseFuelAddress from "utils/parseFuelAddress"
import { parseFuelAddress } from "utils/parseFuelAddress"
import { useMintGuildPinContext } from "../../../MintGuildPinContext"
import type { ClaimParametersInput, GuildActionInput } from "../GuildPinContractAbi"
import { GuildPinContractAbi__factory } from "../GuildPinContractAbi_factory"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,13 @@ import useRole from "components/[guild]/hooks/useRole"
import AddCard from "components/common/AddCard"
import Button from "components/common/Button"
import Section from "components/common/Section"
import { atom } from "jotai"
import useAddRolePlatform from "../hooks/useAddRolePlatform"
import ExistingRolePlatformCard from "./ExistingRolePlatformCard"

type Props = {
roleId?: number
}

export const openRewardSettingsGuildPlatformIdAtom = atom(0)

const EditRolePlatforms = ({ roleId }: Props) => {
const { onOpen } = useAddRewardContext()
const { id: guildId } = useGuild()
Expand Down
2 changes: 1 addition & 1 deletion src/components/[guild]/RoleCard/components/Reward.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,5 @@ const RewardWrapper = ({ platform, ...props }: RewardProps) => {
)
}

export { Reward, RewardIcon, getRewardLabel }
export { RewardIcon }
export default RewardWrapper
3 changes: 0 additions & 3 deletions src/components/[guild]/RolePlatforms/AddRolePlatforms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ import TransitioningPlatformIcons from "components/[guild]/RolePlatforms/compone
import AddCard from "components/common/AddCard"
import Button from "components/common/Button"
import Section from "components/common/Section"
import { atom } from "jotai"
import { useFieldArray, useFormContext } from "react-hook-form"
import { RoleFormType, RolePlatform } from "types"
import NewRolePlatformCard from "../AddAndOrderRoles/components/NewRolePlatformCard"
import { AddRewardProvider, useAddRewardContext } from "../AddRewardContext"
import AddRoleRewardModal from "./components/AddRoleRewardModal"

export const openRewardSettingsGuildPlatformIdAtom = atom(0)

const AddRolePlatforms = () => {
const { onOpen } = useAddRewardContext()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,3 @@ export const DefaultAddRewardPanelWrapper = ({
</ModalContent>
)
}

export default DefaultAddRewardPanelWrapper
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AddRewardPanelProps } from "rewards"
import DefaultAddRewardPanelWrapper from "../../DefaultAddRewardPanelWrapper"
import { DefaultAddRewardPanelWrapper } from "../../DefaultAddRewardPanelWrapper"
import CreateNftForm from "./components/CreateNftForm"

const AddContractCallPanel = ({ onAdd }: AddRewardPanelProps) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export enum ContractCallFunction {
SIMPLE_CLAIM = "function claim(uint256 amount, address receiver, uint256 userId, uint256 signedAt, bytes calldata signature) payable",
}

export const CONTRACT_CALL_ARGS_TO_SIGN: Record<ContractCallFunction, string[]> = {
const CONTRACT_CALL_ARGS_TO_SIGN: Record<ContractCallFunction, string[]> = {
[ContractCallFunction.DEPRECATED_SIMPLE_CLAIM]: [],
[ContractCallFunction.SIMPLE_CLAIM]: ["uint256"],
}
Expand Down
Loading
Loading