Skip to content

Commit

Permalink
feat: inital nounspace config + move pages into src dir
Browse files Browse the repository at this point in the history
  • Loading branch information
hiporox committed Apr 15, 2024
1 parent 37db54d commit 531ee02
Show file tree
Hide file tree
Showing 30 changed files with 101 additions and 96 deletions.
4 changes: 4 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
NEXT_PUBLIC_VERCEL_ENV = development
NEXT_PUBLIC_URL = 'http://localhost:3000'

NEXT_PUBLIC_MOD_PROTOCOL_API_URL = 'https://api.modprotocol.org/api'
3 changes: 3 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
NEXT_PUBLIC_VERCEL_ENV = production
NEXT_PUBLIC_URL = 'https://nounspace.com'
NEXT_PUBLIC_MOD_PROTOCOL_API_URL = 'https://api.modprotocol.org/api'
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ typings/
.yarn-integrity

# dotenv environment variables file
.env
.env.*.local
.env.test
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
Expand Down
1 change: 0 additions & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
9 changes: 4 additions & 5 deletions src/common/components/CastRow.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useState } from "react";
import { castTextStyle, classNames } from "../../../src/common/helpers/css";
import { castTextStyle, classNames } from "@/common/helpers/css";
import {
CastType,
CastReactionType,
} from "../../../src/common/constants/farcaster";
import { ChannelType } from "../../../src/common/constants/channels";
import { useAccountStore } from "../../../src/stores/useAccountStore";
} from "@/common/constants/farcaster";
import { ChannelType } from "@/common/constants/channels";
import { useAccountStore } from "@/stores/useAccountStore";
import {
ArrowPathRoundedSquareIcon,
ArrowTopRightOnSquareIcon,
Expand Down Expand Up @@ -33,7 +33,6 @@ import mentionPlugin, {
cashtagPlugin,
channelPlugin,
} from "../helpers/linkify";
import { toast } from "sonner";
import { AccountPlatformType } from "../constants/accounts";
import { toastInfoReadOnlyMode } from "../helpers/toast";

Expand Down
12 changes: 6 additions & 6 deletions src/common/components/CommandPalette/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { Fragment, useState } from 'react';
import { CommandType } from "../../../common/constants/commands";
import { classNames } from "../../../common/helpers/css";
import { accountCommands, channelCommands, useAccountStore } from '../../../stores/useAccountStore';
import { useNavigationStore } from "../../../stores/useNavigationStore";
import { newPostCommands } from "../../../stores/useNewPostStore";
import { CommandType } from "@/common/constants/commands";
import { classNames } from "@/common/helpers/css";
import { accountCommands, channelCommands, useAccountStore } from '@/stores/useAccountStore';
import { useNavigationStore } from "@/stores/useNavigationStore";
import { newPostCommands } from "@/stores/useNewPostStore";
import { Combobox, Dialog, Transition } from '@headlessui/react';
import { MagnifyingGlassIcon } from '@heroicons/react/20/solid';
import { FaceSmileIcon } from '@heroicons/react/24/outline';
Expand Down Expand Up @@ -39,7 +39,7 @@ export default function CommandPalette() {
})

const { theme, setTheme } = useTheme()
const themeCommands = getThemeCommands(theme, setTheme);
const themeCommands = getThemeCommands(theme!, setTheme);
const navigationCommands = getNavigationCommands({ router });

let commands: CommandType[] = [
Expand Down
6 changes: 3 additions & 3 deletions src/common/components/RightSidebar/AccountsRightSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import {
AccountObjectType,
PENDING_ACCOUNT_NAME_PLACEHOLDER,
useAccountStore,
} from "../../../../src/stores/useAccountStore";
} from "@/stores/useAccountStore";
import { ArrowDownTrayIcon, UserPlusIcon } from "@heroicons/react/24/outline";
import EmptyStateWithAction from "../../../../src/common/components/EmptyStateWithAction";
import { classNames } from "../../../../src/common/helpers/css";
import EmptyStateWithAction from "@/common/components/EmptyStateWithAction";
import { classNames } from "@/common/helpers/css";
import isEmpty from "lodash.isempty";
import ChannelsOverview from "./ChannelsOverview";
import { SidebarHeader } from "./SidebarHeader";
Expand Down
17 changes: 8 additions & 9 deletions src/home/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect } from "react";
import React from "react";
import { Fragment, useState } from "react";
import { Dialog, Transition } from "@headlessui/react";
import { createClient } from "../../src/common/helpers/supabase/component";
import { createClient } from "@/common/helpers/supabase/component";
import {
Cog6ToothIcon,
PlusCircleIcon,
Expand All @@ -11,12 +11,11 @@ import {
Bars3Icon,
UserPlusIcon,
} from "@heroicons/react/20/solid";
import { classNames } from "../common/helpers/css";
import { RIGHT_SIDEBAR_ENUM } from "../common/constants/navigation";
import AccountsRightSidebar from "../common/components/RightSidebar/AccountsRightSidebar";
import ChannelsRightSidebar from "../common/components/RightSidebar/ChannelsRightSidebar";
import { CUSTOM_CHANNELS, useAccountStore } from "../stores/useAccountStore";
import { findParamInHashUrlPath } from "../common/helpers/navigation";
import { classNames } from "@/common/helpers/css";
import { RIGHT_SIDEBAR_ENUM } from "@/common/constants/navigation";
import AccountsRightSidebar from "@/common/components/RightSidebar/AccountsRightSidebar";
import ChannelsRightSidebar from "@/common/components/RightSidebar/ChannelsRightSidebar";
import { CUSTOM_CHANNELS, useAccountStore } from "@/stores/useAccountStore";
import {
BellIcon,
MagnifyingGlassIcon,
Expand All @@ -25,7 +24,7 @@ import {
} from "@heroicons/react/24/solid";
import { useRouter } from "next/router";
import { ThemeToggle } from "@/common/components/ThemeToggle";
import herocastImg from "../../public/images/logo.png";
import herocastImg from "@public/images/logo.png";
import {
TooltipProvider,
} from "@/components/ui/tooltip";
Expand Down
12 changes: 6 additions & 6 deletions pages/_app.tsx → src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import "../src/globals.css";
import "@/globals.css";
import "@rainbow-me/rainbowkit/styles.css";

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

const posthog = loadPosthogAnalytics();
Expand Down
File renamed without changes.
24 changes: 12 additions & 12 deletions pages/accounts/index.tsx → src/pages/accounts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import { ArrowDownTrayIcon, NewspaperIcon } from "@heroicons/react/24/solid";
import {
JoinedHerocastPostDraft,
useNewPostStore,
} from "../../src/stores/useNewPostStore";
import { hydrate, useAccountStore } from "../../src/stores/useAccountStore";
} from "@/stores/useNewPostStore";
import { hydrate, useAccountStore } from "@/stores/useAccountStore";
import isEmpty from "lodash.isempty";
import {
AccountPlatformType,
AccountStatusType,
} from "../../src/common/constants/accounts";
} from "@/common/constants/accounts";
import {
Card,
CardContent,
Expand All @@ -24,24 +24,24 @@ import {
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { Button } from "../../src/components/ui/button";
import { QrCode } from "../../src/common/components/QrCode";
import ConnectFarcasterAccountViaHatsProtocol from "../../src/common/components/ConnectFarcasterAccountViaHatsProtocol";
import { Button } from "@/components/ui/button";
import { QrCode } from "@/common/components/QrCode";
import ConnectFarcasterAccountViaHatsProtocol from "@/common/components/ConnectFarcasterAccountViaHatsProtocol";
import { useAccount } from "wagmi";
import {
WarpcastLoginStatus,
callCreateSignerRequest,
createSignerRequest,
generateWarpcastSigner,
getWarpcastSignerStatus,
} from "../../src/common/helpers/warpcastLogin";
import HelpCard from "../../src/common/components/HelpCard";
import { useIsMounted } from "../../src/common/helpers/hooks";
} from "@/common/helpers/warpcastLogin";
import HelpCard from "@/common/components/HelpCard";
import { useIsMounted } from "@/common/helpers/hooks";
import { useRouter } from "next/router";
import { NeynarAPIClient } from "@neynar/nodejs-sdk";
import { openWindow } from "../../src/common/helpers/navigation";
import ConfirmOnchainSignerButton from "../../src/common/components/ConfirmOnchainSignerButton";
import SwitchWalletButton from "../../src/common/components/SwitchWalletButton";
import { openWindow } from "@/common/helpers/navigation";
import ConfirmOnchainSignerButton from "@/common/components/ConfirmOnchainSignerButton";
import SwitchWalletButton from "@/common/components/SwitchWalletButton";

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

Expand Down
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 '../../../src/common/helpers/supabase/api'
import createClient from '@/common/helpers/supabase/api'

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

export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const requestMethod = req.method;
Expand Down
9 changes: 4 additions & 5 deletions pages/channels/index.tsx → src/pages/channels/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React, { useState } from "react";
import { useAccountStore } from "../../src/stores/useAccountStore";
import { useAccountStore } from "@/stores/useAccountStore";
import isEmpty from "lodash.isempty";
import { ChevronRightIcon, UserPlusIcon } from "@heroicons/react/24/outline";
import { classNames } from "../../src/common/helpers/css";
import { ChannelType } from "../../src/common/constants/channels";
import Toggle from "../../src/common/components/Toggle";
import { classNames } from "@/common/helpers/css";
import { ChannelType } from "@/common/constants/channels";
import Toggle from "@/common/components/Toggle";
import findIndex from "lodash.findindex";
import { MagnifyingGlassIcon } from "@heroicons/react/20/solid";
import includes from "lodash.includes";
Expand Down
File renamed without changes.
20 changes: 10 additions & 10 deletions pages/feed/index.tsx → 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 "../../src/stores/useAccountStore";
import { CastType } from "../../src/common/constants/farcaster";
} from "@/stores/useAccountStore";
import { CastType } from "@/common/constants/farcaster";
import { useHotkeys } from "react-hotkeys-hook";
import get from "lodash.get";
import { CastRow } from "../../src/common/components/CastRow";
import { CastRow } from "@/common/components/CastRow";
import isEmpty from "lodash.isempty";
import { CastThreadView } from "../../src/common/components/CastThreadView";
import { DEFAULT_FEED_PAGE_SIZE } from "../../src/common/helpers/neynar";
import { SelectableListWithHotkeys } from "../../src/common/components/SelectableListWithHotkeys";
import { CastThreadView } from "@/common/components/CastThreadView";
import { DEFAULT_FEED_PAGE_SIZE } from "@/common/helpers/neynar";
import { SelectableListWithHotkeys } from "@/common/components/SelectableListWithHotkeys";
import { Key } from "ts-key-enum";
import ReplyModal from "../../src/common/components/ReplyModal";
import EmbedsModal from "../../src/common/components/EmbedsModal";
import ReplyModal from "@/common/components/ReplyModal";
import EmbedsModal from "@/common/components/EmbedsModal";
import { useInView } from "react-intersection-observer";
import { useRouter } from "next/router";
import { Button } from "../../src/components/ui/button";
import { Button } from "@/components/ui/button";
import { FilterType, NeynarAPIClient } from "@neynar/nodejs-sdk";
import {
CastWithInteractions,
FeedType,
} from "@neynar/nodejs-sdk/build/neynar-api/v2";
import { Loading } from "../../src/common/components/Loading";
import { Loading } from "@/common/components/Loading";
import uniqBy from "lodash.uniqby";
import BigOptionSelector from "@/common/components/BigOptionSelector";

Expand Down
3 changes: 1 addition & 2 deletions pages/hats/index.tsx → src/pages/hats/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { ReactNode, useEffect, useState } from "react";
import { Separator } from "@/components/ui/separator";
import StepSequence from "@/common/components/Steps/StepSequence";
import WalletLogin from "@/common/components/WalletLogin";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
Expand All @@ -14,7 +13,7 @@ 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 "../../src/common/constants/contracts/id-registry";
import { ID_REGISTRY } from "@/common/constants/contracts/id-registry";
import isEmpty from "lodash.isempty";
import clsx from "clsx";
import SwitchWalletButton from "@/common/components/SwitchWalletButton";
Expand Down
2 changes: 1 addition & 1 deletion pages/index.tsx → 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 "../src/common/helpers/supabase/component";
import { createClient } from "@/common/helpers/supabase/component";

const Index = () => {
const router = useRouter();
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React, { useEffect, useState } from "react";

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

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

export default function NewPost() {
const [showToast, setShowToast] = useState(false);
Expand Down
16 changes: 8 additions & 8 deletions pages/profile/[slug].tsx → 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 "../../src/components/ui/avatar";
import { CardHeader, Card } from "../../src/components/ui/card";
import { SelectableListWithHotkeys } from "../../src/common/components/SelectableListWithHotkeys";
import { CastRow } from "../../src/common/components/CastRow";
} from "@/components/ui/avatar";
import { CardHeader, Card } from "@/components/ui/card";
import { SelectableListWithHotkeys } from "@/common/components/SelectableListWithHotkeys";
import { CastRow } from "@/common/components/CastRow";
import { CastWithInteractions } from "@neynar/nodejs-sdk/build/neynar-api/v2/openapi-farcaster/models/cast-with-interactions";
import { Tabs, TabsList, TabsTrigger } from "../../src/components/ui/tabs";
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
import uniqBy from "lodash.uniqby";
import { useHotkeys } from "react-hotkeys-hook";
import FollowButton from "../../src/common/components/FollowButton";
import { useAccountStore } from "../../src/stores/useAccountStore";
import { useDataStore } from "../../src/stores/useDataStore";
import FollowButton from "@/common/components/FollowButton";
import { useAccountStore } from "@/stores/useAccountStore";
import { useDataStore } from "@/stores/useDataStore";

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

Expand Down
10 changes: 5 additions & 5 deletions pages/search/index.tsx → 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 "../../src/common/helpers/searchcaster";
import { SelectableListWithHotkeys } from "../../src/common/components/SelectableListWithHotkeys";
import { searchForText, SearchResultCast } from "@/common/helpers/searchcaster";
import { SelectableListWithHotkeys } from "@/common/components/SelectableListWithHotkeys";
import debounce from "lodash.debounce";
import { CastRow } from "../../src/common/components/CastRow";
import { CastType } from "../../src/common/constants/farcaster";
import { getUrlsInText } from "../../src/common/helpers/text";
import { CastRow } from "@/common/components/CastRow";
import { CastType } from "@/common/constants/farcaster";
import { getUrlsInText } from "@/common/helpers/text";


// export type CastType = {
Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions src/stores/useAccountStore.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { AccountPlatformType, AccountStatusType } from "../../src/common/constants/accounts";
import { ChannelType } from "../../src/common/constants/channels";
import { CommandType } from "../../src/common/constants/commands";
import { randomNumberBetween } from "../../src/common/helpers/math";
import { getAccountsForUser } from "../../src/common/helpers/supabase";
import { AccountPlatformType, AccountStatusType } from "@/common/constants/accounts";
import { ChannelType } from "@/common/constants/channels";
import { CommandType } from "@/common/constants/commands";
import { randomNumberBetween } from "@/common/helpers/math";
import { getAccountsForUser } from "@/common/helpers/supabase";
import { Draft, create as mutativeCreate } from 'mutative';
import { create } from "zustand";
import { createJSONStorage, persist } from "zustand/middleware";
Expand Down
Loading

0 comments on commit 531ee02

Please sign in to comment.