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

File Structure Reorg + Small Fixes #7

Merged
merged 6 commits into from
Apr 18, 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ a protocol for decentralized social apps: https://www.farcaster.xyz
The Nounspace App follows the Atomic Design Pattern
![atomic_design](https://github.com/Nounspace/nounspace.ts/assets/7180740/2c892612-c730-4e74-bd32-3e7a8a6babbb)

Atoms and Moluclues can be found in the `src/common` foloder. Feel free to use existing ones or add your own.
Atoms and Moluclues can be found in the `src/shared/ui` foloder. Feel free to use existing ones or add your own.

Fidgets are a type of Organism, fulfilling the role of sections of a page. To build Fidgets, please add them to the `src/fidgets` directory.

Expand Down
Empty file added src/fidgets/dummy.tsx
Empty file.
2 changes: 1 addition & 1 deletion src/getNavigationCommands.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NextRouter } from 'next/router'
import { CommandType } from './common/constants/commands';
import { CommandType } from './space/common/constants/commands';
import { MagnifyingGlassIcon, RectangleGroupIcon } from '@heroicons/react/20/solid';
import { BellIcon } from '@heroicons/react/24/outline';
import { Bars3BottomLeftIcon } from "@heroicons/react/20/solid";
Expand Down
2 changes: 1 addition & 1 deletion src/getThemeCommands.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { CommandType } from './common/constants/commands';
import { CommandType } from './space/common/constants/commands';
import { ArrowPathRoundedSquareIcon, ComputerDesktopIcon, MoonIcon, SunIcon } from '@heroicons/react/20/solid';

export const getThemeCommands = (theme: string, setTheme: (theme: string) => void): CommandType[] => (
Expand Down
32 changes: 19 additions & 13 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ import "@rainbow-me/rainbowkit/styles.css";

import React, { useEffect } from "react";
import type { AppProps } from "next/app";
import { ThemeProvider } from "@/common/hooks/ThemeProvider";
import { ThemeProvider } from "@/space/common/hooks/ThemeProvider";
import { RainbowKitProvider } from "@rainbow-me/rainbowkit";
import CommandPalette from "@/common/components/CommandPalette";
import CommandPalette from "@/space/common/components/CommandPalette";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { WagmiProvider } from "wagmi";
import { rainbowKitTheme, config } from "@/common/helpers/rainbowkit";
import Home from "@/home";
import { rainbowKitTheme, config } from "@/space/common/helpers/rainbowkit";
import Home from "@/space/home";
import { PostHogProvider } from "posthog-js/react";
import { loadPosthogAnalytics } from "@/lib/analytics";
import { loadPosthogAnalytics } from "@/space/lib/analytics";
import { useRouter } from "next/router";
import Head from "next/head";

const posthog = loadPosthogAnalytics();

Expand Down Expand Up @@ -46,13 +47,18 @@ export default function MyApp({ Component, pageProps }: AppProps) {
);

return (
<ThemeProvider
attribute="class"
defaultTheme="light"
enableSystem
disableTransitionOnChange
>
{children}
</ThemeProvider>
<>
<Head>
<title>Nounspace</title>
</Head>
<ThemeProvider
attribute="class"
defaultTheme="light"
enableSystem
disableTransitionOnChange
>
{children}
</ThemeProvider>
</>
);
}
1 change: 0 additions & 1 deletion src/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export default function Document() {
return (
<Html lang="en">
<Head>
<title>herocast</title>
<meta name="description" content="herocast" />
<meta property="og:site_name" content="herocast" />
<meta property="og:title" content="herocast" />
Expand Down
26 changes: 13 additions & 13 deletions src/pages/accounts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,39 @@ import { ArrowDownTrayIcon, NewspaperIcon } from "@heroicons/react/24/solid";
import {
JoinedHerocastPostDraft,
useNewPostStore,
} from "@/stores/useNewPostStore";
import { hydrate, useAccountStore } from "@/stores/useAccountStore";
} from "@/space/stores/useNewPostStore";
import { hydrate, useAccountStore } from "@/space/stores/useAccountStore";
import { isEmpty } from "lodash";
import {
AccountPlatformType,
AccountStatusType,
} from "@/common/constants/accounts";
} from "@/space/common/constants/accounts";
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { Button } from "@/components/ui/button";
import { QrCode } from "@/common/components/QrCode";
import ConnectFarcasterAccountViaHatsProtocol from "@/common/components/ConnectFarcasterAccountViaHatsProtocol";
} from "@/shared/ui/card";
import { Button } from "@/shared/ui/button";
import { QrCode } from "@/space/common/components/QrCode";
import ConnectFarcasterAccountViaHatsProtocol from "@/space/common/components/ConnectFarcasterAccountViaHatsProtocol";
import { useAccount } from "wagmi";
import {
WarpcastLoginStatus,
callCreateSignerRequest,
createSignerRequest,
generateWarpcastSigner,
getWarpcastSignerStatus,
} from "@/common/helpers/warpcastLogin";
import HelpCard from "@/common/components/HelpCard";
import { useIsMounted } from "@/common/helpers/hooks";
} from "@/space/common/helpers/warpcastLogin";
import HelpCard from "@/space/common/components/HelpCard";
import { useIsMounted } from "@/space/common/helpers/hooks";
import { useRouter } from "next/router";
import { NeynarAPIClient } from "@neynar/nodejs-sdk";
import { openWindow } from "@/common/helpers/navigation";
import ConfirmOnchainSignerButton from "@/common/components/ConfirmOnchainSignerButton";
import SwitchWalletButton from "@/common/components/SwitchWalletButton";
import { openWindow } from "@/space/common/helpers/navigation";
import ConfirmOnchainSignerButton from "@/space/common/components/ConfirmOnchainSignerButton";
import SwitchWalletButton from "@/space/common/components/SwitchWalletButton";

const APP_FID = Number(process.env.NEXT_PUBLIC_APP_FID!);

Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/auth/confirm.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type EmailOtpType } from '@supabase/supabase-js'
import type { NextApiRequest, NextApiResponse } from 'next'

import createClient from '@/common/helpers/supabase/api'
import createClient from '@/space/common/helpers/supabase/api'

function stringOrFirstString(item: string | string[] | undefined) {
return Array.isArray(item) ? item[0] : item
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/signerRequest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { NextApiRequest, NextApiResponse } from 'next'
import { createSignerRequest, getSignerRequestStatus } from '@/common/helpers/warpcastLogin';
import { createSignerRequest, getSignerRequestStatus } from '@/space/common/helpers/warpcastLogin';

export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const requestMethod = req.method;
Expand Down
8 changes: 4 additions & 4 deletions src/pages/channels/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useState } from "react";
import { useAccountStore } from "@/stores/useAccountStore";
import { classNames } from "@/common/helpers/css";
import { ChannelType } from "@/common/constants/channels";
import Toggle from "@/common/components/Toggle";
import { useAccountStore } from "@/space/stores/useAccountStore";
import { classNames } from "@/space/common/helpers/css";
import { ChannelType } from "@/space/common/constants/channels";
import Toggle from "@/space/common/components/Toggle";
import { MagnifyingGlassIcon } from "@heroicons/react/20/solid";
import SortableList, { SortableItem } from "react-easy-sort";
import { useRouter } from "next/router";
Expand Down
12 changes: 6 additions & 6 deletions src/pages/farcaster-signup/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React, { ReactNode, useEffect, useState } from "react";
import { Separator } from "@/components/ui/separator";
import { Button } from "@/components/ui/button";
import StepSequence from "@/common/components/Steps/StepSequence";
import RegisterFarcasterUsernameForm from "@/common/components/RegisterFarcasterUsernameForm";
import CreateFarcasterAccount from "@/common/components/CreateFarcasterAccount";
import { Separator } from "@/shared/ui/separator";
import { Button } from "@/shared/ui/button";
import StepSequence from "@/space/common/components/Steps/StepSequence";
import RegisterFarcasterUsernameForm from "@/space/common/components/RegisterFarcasterUsernameForm";
import CreateFarcasterAccount from "@/space/common/components/CreateFarcasterAccount";
import { useAccount } from "wagmi";
import { useRouter } from "next/router";
import { useAccountModal, useConnectModal } from "@rainbow-me/rainbowkit";
import SwitchWalletButton from "@/common/components/SwitchWalletButton";
import SwitchWalletButton from "@/space/common/components/SwitchWalletButton";

enum FarcasterSignupNav {
login = "LOGIN",
Expand Down
22 changes: 11 additions & 11 deletions src/pages/feed/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@ import {
AccountObjectType,
CUSTOM_CHANNELS,
useAccountStore,
} from "@/stores/useAccountStore";
import { CastType } from "@/common/constants/farcaster";
} from "@/space/stores/useAccountStore";
import { CastType } from "@/space/common/constants/farcaster";
import { useHotkeys } from "react-hotkeys-hook";
import { get, isEmpty, uniqBy } from "lodash";
import { CastRow } from "@/common/components/CastRow";
import { CastThreadView } from "@/common/components/CastThreadView";
import { DEFAULT_FEED_PAGE_SIZE } from "@/common/helpers/neynar";
import { SelectableListWithHotkeys } from "@/common/components/SelectableListWithHotkeys";
import { CastRow } from "@/space/common/components/CastRow";
import { CastThreadView } from "@/space/common/components/CastThreadView";
import { DEFAULT_FEED_PAGE_SIZE } from "@/space/common/helpers/neynar";
import { SelectableListWithHotkeys } from "@/space/common/components/SelectableListWithHotkeys";
import { Key } from "ts-key-enum";
import ReplyModal from "@/common/components/ReplyModal";
import EmbedsModal from "@/common/components/EmbedsModal";
import ReplyModal from "@/space/common/components/ReplyModal";
import EmbedsModal from "@/space/common/components/EmbedsModal";
import { useInView } from "react-intersection-observer";
import { useRouter } from "next/router";
import { Button } from "@/components/ui/button";
import { Button } from "@/shared/ui/button";
import { FilterType, NeynarAPIClient } from "@neynar/nodejs-sdk";
import {
CastWithInteractions,
FeedType,
} from "@neynar/nodejs-sdk/build/neynar-api/v2";
import { Loading } from "@/common/components/Loading";
import BigOptionSelector from "@/common/components/BigOptionSelector";
import { Loading } from "@/space/common/components/Loading";
import BigOptionSelector from "@/space/common/components/BigOptionSelector";

type FeedsType = {
[key: string]: CastWithInteractions[];
Expand Down
26 changes: 13 additions & 13 deletions src/pages/hats/index.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import React, { ReactNode, useEffect, useState } from "react";
import { Separator } from "@/components/ui/separator";
import StepSequence from "@/common/components/Steps/StepSequence";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Separator } from "@/shared/ui/separator";
import StepSequence from "@/space/common/components/Steps/StepSequence";
import { Button } from "@/shared/ui/button";
import { Input } from "@/shared/ui/input";
import { Label } from "@/shared/ui/label";
import { ClipboardDocumentIcon } from "@heroicons/react/20/solid";
import { useAccount, useReadContract } from "wagmi";
import { NeynarAPIClient } from "@neynar/nodejs-sdk";
import { User } from "@neynar/nodejs-sdk/build/neynar-api/v2";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import BigOptionSelector from "@/common/components/BigOptionSelector";
import SharedAccountOwnershipSetup from "@/common/components/SharedAccountOwnershipSetup";
import TransferAccountToHatsDelegator from "@/common/components/TransferAccountToHatsDelegator";
import { openWindow } from "@/common/helpers/navigation";
import { ID_REGISTRY } from "@/common/constants/contracts/id-registry";
import { Avatar, AvatarFallback, AvatarImage } from "@/shared/ui/avatar";
import BigOptionSelector from "@/space/common/components/BigOptionSelector";
import SharedAccountOwnershipSetup from "@/space/common/components/SharedAccountOwnershipSetup";
import TransferAccountToHatsDelegator from "@/space/common/components/TransferAccountToHatsDelegator";
import { openWindow } from "@/space/common/helpers/navigation";
import { ID_REGISTRY } from "@/space/common/constants/contracts/id-registry";
import { isEmpty } from "lodash";
import clsx from "clsx";
import SwitchWalletButton from "@/common/components/SwitchWalletButton";
import { Loading } from "@/common/components/Loading";
import SwitchWalletButton from "@/space/common/components/SwitchWalletButton";
import { Loading } from "@/space/common/components/Loading";

enum HatsSignupNav {
select_account = "SELECT_ACCOUNT",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect } from "react";
import { useRouter } from "next/router";
import { createClient } from "@/common/helpers/supabase/component";
import { createClient } from "@/space/common/helpers/supabase/component";

const Index = () => {
const router = useRouter();
Expand Down
6 changes: 3 additions & 3 deletions src/pages/login/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import "@farcaster/auth-kit/styles.css";
import React from "react";
import { UserAuthForm } from "@/common/components/UserAuthForm";
import { UserAuthForm } from "@/space/common/components/UserAuthForm";
import { AuthKitProvider } from "@farcaster/auth-kit";
import { Button } from "@/components/ui/button";
import { openWindow } from "@/common/helpers/navigation";
import { Button } from "@/shared/ui/button";
import { openWindow } from "@/space/common/helpers/navigation";
import Link from "next/link";
import clsx from "clsx";

Expand Down
14 changes: 7 additions & 7 deletions src/pages/notifications/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React, { useEffect, useState } from "react";

import { castTextStyle, classNames } from "@/common/helpers/css";
import { useAccountStore } from "@/stores/useAccountStore";
import { SelectableListWithHotkeys } from "@/common/components/SelectableListWithHotkeys";
import { localize, timeDiff } from "@/common/helpers/date";
import { CastThreadView } from "@/common/components/CastThreadView";
import { castTextStyle, classNames } from "@/space/common/helpers/css";
import { useAccountStore } from "@/space/stores/useAccountStore";
import { SelectableListWithHotkeys } from "@/space/common/components/SelectableListWithHotkeys";
import { localize, timeDiff } from "@/space/common/helpers/date";
import { CastThreadView } from "@/space/common/components/CastThreadView";
import { isEmpty } from "lodash";
import { useHotkeys } from "react-hotkeys-hook";
import { Key } from "ts-key-enum";
import { CastType } from "@/common/constants/farcaster";
import ReplyModal from "@/common/components/ReplyModal";
import { CastType } from "@/space/common/constants/farcaster";
import ReplyModal from "@/space/common/components/ReplyModal";
import { NeynarAPIClient } from "@neynar/nodejs-sdk";
import { CastWithInteractions } from "@neynar/nodejs-sdk/build/neynar-api/v1";

Expand Down
10 changes: 5 additions & 5 deletions src/pages/post/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import NewPostEntry from "@/common/components/NewPostEntry";
import { classNames } from "@/common/helpers/css";
import { useNewPostStore } from "@/stores/useNewPostStore";
import NewPostEntry from "@/space/common/components/NewPostEntry";
import { classNames } from "@/space/common/helpers/css";
import { useNewPostStore } from "@/space/stores/useNewPostStore";
import React, { useEffect, useState } from "react";
import { PlusCircleIcon, TrashIcon } from "@heroicons/react/24/outline";
import * as Tooltip from "@radix-ui/react-tooltip";
import HotkeyTooltipWrapper from "@/common/components/HotkeyTooltipWrapper";
import { Button } from "@/components/ui/button";
import HotkeyTooltipWrapper from "@/space/common/components/HotkeyTooltipWrapper";
import { Button } from "@/shared/ui/button";

export default function NewPost() {
const [showToast, setShowToast] = useState(false);
Expand Down
16 changes: 8 additions & 8 deletions src/pages/profile/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ import {
AvatarImage,
AvatarFallback,
Avatar,
} from "@/components/ui/avatar";
import { CardHeader, Card } from "@/components/ui/card";
import { SelectableListWithHotkeys } from "@/common/components/SelectableListWithHotkeys";
import { CastRow } from "@/common/components/CastRow";
} from "@/shared/ui/avatar";
import { CardHeader, Card } from "@/shared/ui/card";
import { SelectableListWithHotkeys } from "@/space/common/components/SelectableListWithHotkeys";
import { CastRow } from "@/space/common/components/CastRow";
import { CastWithInteractions } from "@neynar/nodejs-sdk/build/neynar-api/v2/openapi-farcaster/models/cast-with-interactions";
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { Tabs, TabsList, TabsTrigger } from "@/shared/ui/tabs";
import { uniqBy } from "lodash";
import { useHotkeys } from "react-hotkeys-hook";
import FollowButton from "@/common/components/FollowButton";
import { useAccountStore } from "@/stores/useAccountStore";
import { useDataStore } from "@/stores/useDataStore";
import FollowButton from "@/space/common/components/FollowButton";
import { useAccountStore } from "@/space/stores/useAccountStore";
import { useDataStore } from "@/space/stores/useDataStore";

const APP_FID = Number(process.env.NEXT_PUBLIC_APP_FID!);

Expand Down
10 changes: 5 additions & 5 deletions src/pages/search/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useEffect, useRef, useState } from "react";
import { InformationCircleIcon, MagnifyingGlassIcon } from "@heroicons/react/24/outline";
import { searchForText, SearchResultCast } from "@/common/helpers/searchcaster";
import { SelectableListWithHotkeys } from "@/common/components/SelectableListWithHotkeys";
import { searchForText, SearchResultCast } from "@/space/common/helpers/searchcaster";
import { SelectableListWithHotkeys } from "@/space/common/components/SelectableListWithHotkeys";
import { debounce } from "lodash";
import { CastRow } from "@/common/components/CastRow";
import { CastType } from "@/common/constants/farcaster";
import { getUrlsInText } from "@/common/helpers/text";
import { CastRow } from "@/space/common/components/CastRow";
import { CastType } from "@/space/common/constants/farcaster";
import { getUrlsInText } from "@/space/common/helpers/text";


// export type CastType = {
Expand Down
Loading
Loading