Skip to content

Commit

Permalink
cleanup: remove unused exports
Browse files Browse the repository at this point in the history
  • Loading branch information
BrickheadJohnny committed Sep 20, 2024
1 parent 3cc48b5 commit e9389d5
Show file tree
Hide file tree
Showing 61 changed files with 65 additions and 264 deletions.
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useWatch } from "react-hook-form"
import { AddRewardPanelProps } from "rewards"
import { ConnectPlatformFallback } from "solutions/components/ConnectPlatformFallback"
import { PlatformGuildData, PlatformType } from "types"
import DefaultAddRewardPanelWrapper from "../DefaultAddRewardPanelWrapper"
import { DefaultAddRewardPanelWrapper } from "../DefaultAddRewardPanelWrapper"

const AddDiscordPanel = ({ onAdd }: AddRewardPanelProps) => {
// TODO: we could somehow extract this piece of logis from here to make sure that AddDiscordPanel doesn't depend on the role form's state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { AddRewardPanelProps } from "rewards"
import { PlatformGuildData, PlatformType } from "types"
import { uuidv7 } from "uuidv7"
import { CreateForm } from "."
import DefaultAddRewardPanelWrapper from "../../DefaultAddRewardPanelWrapper"
import { DefaultAddRewardPanelWrapper } from "../../DefaultAddRewardPanelWrapper"
import ContinueWithExistingFormAlert from "./components/ContinueWithExistingFormAlert"

const defaultValues: CreateForm = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
gatherSpaceUrlToSpaceId,
} from "rewards/Gather/useGatherCardProps"
import { PlatformType } from "types"
import DefaultAddRewardPanelWrapper from "../DefaultAddRewardPanelWrapper"
import { DefaultAddRewardPanelWrapper } from "../DefaultAddRewardPanelWrapper"

export type AddGatherFormType = {
gatherApiKey: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { FormProvider, useForm } from "react-hook-form"
import { AddRewardPanelProps } from "rewards"
import { ConnectPlatformFallback } from "solutions/components/ConnectPlatformFallback"
import { PlatformType } from "types"
import DefaultAddRewardPanelWrapper from "../DefaultAddRewardPanelWrapper"
import { DefaultAddRewardPanelWrapper } from "../DefaultAddRewardPanelWrapper"

const defaultValues = {
platformGuildId: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { FormProvider, useForm } from "react-hook-form"
import { AddRewardPanelProps } from "rewards"
import { ConnectPlatformFallback } from "solutions/components/ConnectPlatformFallback"
import { PlatformType } from "types"
import DefaultAddRewardPanelWrapper from "../DefaultAddRewardPanelWrapper"
import { DefaultAddRewardPanelWrapper } from "../DefaultAddRewardPanelWrapper"

const defaultValues = {
platformGuildId: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { FormProvider, useController, useForm, useWatch } from "react-hook-form"
import usePoapById from "requirements/Poap/hooks/usePoapById"
import rewards, { AddRewardPanelProps } from "rewards"
import { PlatformGuildData, PlatformType } from "types"
import DefaultAddRewardPanelWrapper from "../../DefaultAddRewardPanelWrapper"
import { DefaultAddRewardPanelWrapper } from "../../DefaultAddRewardPanelWrapper"
import UploadMintLinks from "./components/UploadMintLinks"

export type ImportPoapForm = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ImportPoapForm } from "../AddPoapPanel"
const LEGACY_POAP_MINT_LINK_BASE = "http://poap.xyz/claim/"
const POAP_MINT_LINK_BASE = "http://poap.xyz/mint/"

export const validatePoapLinks = (links: string[]) =>
const validatePoapLinks = (links: string[]) =>
links
.filter(Boolean)
.map((link) => link.toLowerCase())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Button from "components/common/Button"
import { FormProvider, useForm, useWatch } from "react-hook-form"
import { AddRewardPanelProps } from "rewards"
import { PlatformGuildData, PlatformType } from "types"
import DefaultAddRewardPanelWrapper from "../../DefaultAddRewardPanelWrapper"
import { DefaultAddRewardPanelWrapper } from "../../DefaultAddRewardPanelWrapper"
import AddNewPointsType from "./components/AddNewPointsType"
import ExistingPointsTypeSelect, {
CREATE_NEW_OPTION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import UniqueTextDataForm, {
UniqueTextRewardForm,
} from "rewards/UniqueText/UniqueTextDataForm"
import { PlatformGuildData, PlatformName, PlatformType } from "types"
import DefaultAddRewardPanelWrapper from "../DefaultAddRewardPanelWrapper"
import { DefaultAddRewardPanelWrapper } from "../DefaultAddRewardPanelWrapper"

enum TextPlatformName {
TEXT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import TelegramGroup from "components/create-guild/TelegramGroup"
import { FormProvider, useForm, useWatch } from "react-hook-form"
import { AddRewardPanelProps } from "rewards"
import { PlatformType } from "types"
import DefaultAddRewardPanelWrapper from "../DefaultAddRewardPanelWrapper"
import { DefaultAddRewardPanelWrapper } from "../DefaultAddRewardPanelWrapper"

const AddTelegramPanel = ({ onAdd }: AddRewardPanelProps) => {
const methods = useForm({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { FormProvider, useForm } from "react-hook-form"
import { AddRewardPanelProps } from "rewards"
import { PlatformGuildData, PlatformType } from "types"
import { ERC20_CONTRACTS } from "utils/guildCheckout/constants"
import DefaultAddRewardPanelWrapper from "../../DefaultAddRewardPanelWrapper"
import { DefaultAddRewardPanelWrapper } from "../../DefaultAddRewardPanelWrapper"
import PoolStep from "./components/PoolStep"
import SetTokenStep from "./components/SetTokenStep"
import TokenAmountStep from "./components/TokenAmountStep"
Expand Down
2 changes: 1 addition & 1 deletion src/components/[guild]/Roles.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Center, Spinner, Stack } from "@chakra-ui/react"
import CollapsibleRoleSection from "components/[guild]/CollapsibleRoleSection"
import { RequirementErrorConfigProvider } from "components/[guild]/Requirements/RequirementErrorConfigContext"
import RoleCard from "components/[guild]/RoleCard/RoleCard"
import RoleCard from "components/[guild]/RoleCard"
import useGuild from "components/[guild]/hooks/useGuild"
import { useScrollBatchedRendering } from "hooks/useScrollBatchedRendering"
import dynamic from "next/dynamic"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const FILTER_NAMES: Record<SupportedSearchOption, string> = {
action: "Action",
}

export const SUPPORTED_QUERY_PARAMS = [
const SUPPORTED_QUERY_PARAMS = [
"order",
"limit",
"offset",
Expand Down
4 changes: 2 additions & 2 deletions src/components/[guild]/crm/CRMTable/CrmTbody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export const CrmSkeletonRow = ({ columns }) => (
</Tr>
)

export const CrmTd = ({ children, ...rest }) => {
const CrmTd = ({ children, ...rest }) => {
const tdBg = useColorModeValue(`gray.50`, "#3A3A40") // dark color is from blackAlpha.200, but without opacity so it can overlay when sticky

return (
Expand All @@ -129,7 +129,7 @@ export const CrmTd = ({ children, ...rest }) => {
)
}

export const CrmInteractiveTd = ({ children, ...rest }) => {
const CrmInteractiveTd = ({ children, ...rest }) => {
const tdHoverBg = useColorModeValue(`blackAlpha.50`, "whiteAlpha.50")

return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/[guild]/crm/MemberModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import useResolveAddress from "hooks/useResolveAddress"
import useGuild from "../hooks/useGuild"
import { WalletTag } from "./Identities"
import { ClickableCrmRoleTag } from "./RoleTags"
import UserPlatformTags from "./UserPlatformTags"
import { UserPlatformTags } from "./UserPlatformTags"
import { Member } from "./useMembers"

type Props = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/[guild]/crm/RoleTags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ const CrmTbodyRoleTag = memo(
})
)

export const CrmRoleTag = memo(
const CrmRoleTag = memo(
forwardRef<RoleTagProps, "span">(({ role, amount: amountProp, ...rest }, ref) => {
if (!role) return null

Expand Down
2 changes: 0 additions & 2 deletions src/components/[guild]/crm/UserPlatformTags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,3 @@ const getPlatformUrl = (platformAccount: PlatformAccountDetails) => {

return platformUrls[platformId]
}

export default UserPlatformTags
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Center, Collapse, Icon, IconButton } from "@chakra-ui/react"
import { CaretDown } from "@phosphor-icons/react"
import { WalletTag } from "components/[guild]/crm/Identities"
import UserPlatformTags from "components/[guild]/crm/UserPlatformTags"
import { UserPlatformTags } from "components/[guild]/crm/UserPlatformTags"
import useGuild from "components/[guild]/hooks/useGuild"
import { LinkButton } from "components/common/LinkMenuItem"
import useResolveAddress from "hooks/useResolveAddress"
Expand Down
39 changes: 1 addition & 38 deletions src/components/[guild]/leaderboard/LeaderboardAirdropCard.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import {
Box,
Center,
Flex,
HStack,
Heading,
Skeleton,
SkeletonCircle,
Stack,
Text,
VStack,
useColorModeValue,
} from "@chakra-ui/react"
import Card, { useCardBg } from "components/common/Card"
Expand Down Expand Up @@ -152,36 +148,6 @@ const LeaderboardAirdropCard = () => {
)
}

const LeaderboardAirdopSkeleton = () => {
const positionBgColor = useColorModeValue("gray.50", "blackAlpha.300")
const positionBorderColor = useColorModeValue("gray.200", "gray.600")

return (
<Card>
<HStack spacing={0}>
<Center
minW={{ base: 16, sm: 24 }}
maxW={{ base: 16, sm: 24 }}
placeSelf="stretch"
bgColor={positionBgColor}
borderRightWidth={1}
borderRightColor={positionBorderColor}
>
<Skeleton boxSize={{ base: 6, sm: 8 }} />
</Center>
<HStack spacing={4} px={{ base: 5, md: 6 }} py={{ base: 5, md: 7 }}>
<SkeletonCircle boxSize={10} />

<VStack alignItems="start" spacing={0}>
<Skeleton w={48} />
<Skeleton w={24} h={4} />
</VStack>
</HStack>
</HStack>
</Card>
)
}

const LeaderboardAirdropCardWrapper = ({
guildPlatform,
}: {
Expand All @@ -200,7 +166,4 @@ const LeaderboardAirdropCardWrapper = ({
)
}

export {
LeaderboardAirdopSkeleton,
LeaderboardAirdropCardWrapper as LeaderboardAirdropCard,
}
export { LeaderboardAirdropCardWrapper as LeaderboardAirdropCard }
2 changes: 1 addition & 1 deletion src/components/common/RadioButtonGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ type RadioButtonProps = {
} & RadioButtonOptionProps &
UseRadioProps

export const RadioButton = (props: RadioButtonProps & { isDisabled?: boolean }) => {
const RadioButton = (props: RadioButtonProps & { isDisabled?: boolean }) => {
const { getInputProps, getCheckboxProps } = useRadio(props)

const input = getInputProps()
Expand Down
2 changes: 1 addition & 1 deletion src/components/create-guild/IconSelector/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const imageDimensionsValidator = (
return null
}

export const getDimensionErrorMessage = (minW?: number, minH?: number): string => {
const getDimensionErrorMessage = (minW?: number, minH?: number): string => {
if (minW && minH) return `Image should be at least ${minW}x${minH}px`
return `Image ${minW ? "width" : "height"} should be at least ${minW || minH}px`
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,5 +275,4 @@ const useBalancy = (
}
}

export { BALANCY_SUPPORTED_CHAINS }
export default useBalancy
Loading

0 comments on commit e9389d5

Please sign in to comment.