From 558a3055475619ffa4bd8d7dd3302e9b444bb009 Mon Sep 17 00:00:00 2001 From: Vlad 2 <116202536+sktbrd@users.noreply.github.com> Date: Mon, 16 Sep 2024 13:47:35 -0300 Subject: [PATCH 1/8] Update index.ts - Hide Create Cast (#431) --- src/fidgets/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fidgets/index.ts b/src/fidgets/index.ts index 7da82e50..6cb8665a 100644 --- a/src/fidgets/index.ts +++ b/src/fidgets/index.ts @@ -9,7 +9,7 @@ import Grid from "./layout/Grid"; import NounishGovernance from "./community/nouns-dao/NounishGovernance"; import Cast from "./farcaster/Cast"; import Feed from "./farcaster/Feed"; -import CreateCast from "./farcaster/CreateCast"; +// import CreateCast from "./farcaster/CreateCast"; import Links from "./ui/Links"; import snapShot from "./snapshot/SnapShot"; // import Swap from "./swap/Swap"; @@ -26,7 +26,7 @@ export const CompleteFidgets = { frame: Frame, feed: Feed, cast: Cast, - createCast: CreateCast, + // createCast: CreateCast, // Basic UI elements gallery: Gallery, text: TextFidget, From a5cabfb3e9660c55b7707c78efe20c1347dc6208 Mon Sep 17 00:00:00 2001 From: Vlad 2 <116202536+sktbrd@users.noreply.github.com> Date: Mon, 16 Sep 2024 18:47:45 -0300 Subject: [PATCH 2/8] Fix: Add Fidget button (#433) --- src/fidgets/layout/Grid.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fidgets/layout/Grid.tsx b/src/fidgets/layout/Grid.tsx index 8d3e3553..08dbe15c 100644 --- a/src/fidgets/layout/Grid.tsx +++ b/src/fidgets/layout/Grid.tsx @@ -337,9 +337,9 @@ const Grid: LayoutFidget = ({ {inEditMode && ( +
+ +
{hasEmbeds && ( diff --git a/src/fidgets/farcaster/components/channelPicker.tsx b/src/fidgets/farcaster/components/channelPicker.tsx new file mode 100644 index 00000000..8c11d537 --- /dev/null +++ b/src/fidgets/farcaster/components/channelPicker.tsx @@ -0,0 +1,111 @@ +"use client"; + +import * as React from "react"; +import { CaretDownIcon } from "@radix-ui/react-icons"; +import { Button } from "@/common/components/atoms/button"; +import { + Command, + CommandInput, + CommandItem, + CommandEmpty, + CommandGroup, + CommandList, +} from "@/common/components/atoms/command"; // Adjust the import paths if needed +import { + Popover, + PopoverTrigger, + PopoverContent, +} from "@/common/components/atoms/popover"; // Adjust the import paths if needed +import { Channel } from "@mod-protocol/farcaster"; // Assuming this is your type + +type Props = { + getChannels: (query: string) => Promise; + onSelect: (value: Channel) => void; + value: Channel; + initialChannels?: Channel[]; +}; + +export function ChannelPicker(props: Props) { + const { getChannels, onSelect, value } = props; + const [open, setOpen] = React.useState(false); + const [channelResults, setChannelResults] = React.useState( + props.initialChannels ?? [], + ); + const [query, setQuery] = React.useState(""); + + React.useEffect(() => { + async function fetchChannels() { + const channels = await getChannels(query); + setChannelResults(channels); + } + + if (query !== "") { + fetchChannels(); + } else { + setChannelResults(props.initialChannels ?? []); + } + }, [getChannels, query, props.initialChannels]); + + const handleSelect = React.useCallback( + (channel: Channel) => { + setOpen(false); + onSelect(channel); + }, + [onSelect], + ); + + return ( + + + + + + + + + {channelResults.length === 0 ? ( + No channels found. + ) : ( + channelResults.map((channel) => ( + handleSelect(channel)} + > + {channel.name} + {channel.name} + + )) + )} + + + + + ); +} diff --git a/src/fidgets/farcaster/utils.ts b/src/fidgets/farcaster/utils.ts index 7bae5bc9..817ef7f2 100644 --- a/src/fidgets/farcaster/utils.ts +++ b/src/fidgets/farcaster/utils.ts @@ -137,15 +137,37 @@ export const submitCast = async ( fid: number, signer: Signer, ) => { - const castAddMessageResp = await makeCastAdd( - unsignedCastBody, - { fid, network: FarcasterNetwork.MAINNET }, - signer, - ); - if (castAddMessageResp.isOk()) { - return await submitMessageToBackend(castAddMessageResp.value); + try { + const castAddMessageResp = await makeCastAdd( + unsignedCastBody, + { fid, network: FarcasterNetwork.MAINNET }, // Ensure the network and fid are correct + signer, + ); + + // Check if cast creation was successful + if (!castAddMessageResp.isOk()) { + console.error("makeCastAdd failed with error:", castAddMessageResp.error); // Log the error returned + return false; + } + + // Submit the created message to the backend + const backendResponse = await submitMessageToBackend( + castAddMessageResp.value, + ); + + if (!backendResponse) { + console.error( + "submitMessageToBackend failed, response:", + backendResponse, + ); + return false; + } + + return backendResponse; + } catch (error) { + console.error("Error in submitCast:", error); + return false; } - return false; }; export const getDeadline = (): bigint => { From 2114d6d7dfd1a3b876889c0bf9b54d837446e35e Mon Sep 17 00:00:00 2001 From: Vlad 2 <116202536+sktbrd@users.noreply.github.com> Date: Thu, 19 Sep 2024 21:53:04 -0300 Subject: [PATCH 5/8] Redirect Users for space.nounspace.com in Mobile when url is /s/spacetoken (#422) --- src/middleware.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/middleware.ts b/src/middleware.ts index ac6685e3..52638cb6 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -2,13 +2,19 @@ import { NextResponse } from "next/server"; import { NextRequest, userAgent } from "next/server"; import MOBILE_REDIRECT_URL from "@/constants/mobileRedirectUrl"; -// Mobile redirect export async function middleware(request: NextRequest) { const { device } = userAgent(request); + const url = request.nextUrl; if (device.type === "mobile") { - return NextResponse.redirect(new URL(MOBILE_REDIRECT_URL)); + if (url.pathname === "/s/spacetoken") { + return NextResponse.redirect(new URL("https://space.nounspace.com")); + } + + return NextResponse.redirect(new URL(`${MOBILE_REDIRECT_URL}`)); } + + return NextResponse.next(); } export const config = { From e5e968330e69e96a79baf108c22a4c3b8a0e86ca Mon Sep 17 00:00:00 2001 From: Vlad 2 <116202536+sktbrd@users.noreply.github.com> Date: Thu, 19 Sep 2024 21:53:14 -0300 Subject: [PATCH 6/8] hyperlinks opens in a new tab (#437) --- src/common/lib/utils/markdownRenderers.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/common/lib/utils/markdownRenderers.tsx b/src/common/lib/utils/markdownRenderers.tsx index 0d735805..b8bfc1f8 100644 --- a/src/common/lib/utils/markdownRenderers.tsx +++ b/src/common/lib/utils/markdownRenderers.tsx @@ -57,7 +57,13 @@ export const MarkdownRenderers = (linkColor?: string) => ({ }; return ( - + {children} ); From b009b96f59e833699a6e12929710ff987d2e316a Mon Sep 17 00:00:00 2001 From: Vlad 2 <116202536+sktbrd@users.noreply.github.com> Date: Thu, 19 Sep 2024 21:53:33 -0300 Subject: [PATCH 7/8] default tutorial text fidget (#438) --- src/constants/intialHomebase.ts | 81 ++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 2 deletions(-) diff --git a/src/constants/intialHomebase.ts b/src/constants/intialHomebase.ts index 95e9af12..606833b5 100644 --- a/src/constants/intialHomebase.ts +++ b/src/constants/intialHomebase.ts @@ -1,17 +1,94 @@ import { SpaceConfig } from "@/common/components/templates/Space"; import DEFAULT_THEME from "@/common/lib/theme/defaultTheme"; +const tutorialText = ` + ## To start customizing, click the paintbrush in the bottom left next to 'Cast' ⬋🖌️⬋ + +### Add Fidgets +From customization mode, click the big blue **+** button. Then, drag a Fidget to an open spot on the grid. Finally, click Save so you can scroll down here for more instructions. + +![DragFidget-ezgif.com-loop-count](https://hackmd.io/_uploads/S1MTNDTsC.gif) + +scroll down for more ⬇️ ⬇️ ⬇️ + +### Customize Fidgets +Click any Fidget on the grid to open its settings. In addition to configuring each Fidget's settings, you can customize its look in the 'Style' tab. Any Fidget style parameters set to "Theme" inherit their look from the theme of their Tab. + +![EditFidget-ezgif.com-loop-count](https://hackmd.io/_uploads/r1pTND6s0.gif) + +### Arrange Fidgets +- **Move:** Click and drag fidgets from the middle to move them +![move fidget](https://nounspace.mypinata.cloud/ipfs/QmYWvdpdiyKwjVAqjhcFTBkiTUnc8rF4p2EGg3C4sTRsr6) +- **Resize:** Click and drag fidgets' edges to resize them +![2024-08-28 21.05.59](https://hackmd.io/_uploads/ryxADUpjC.gif) +- **Stash in Fidget Tray:** Click a fidget then click the ⇱ icon above it to save it in your Fidget Tray for later. +![image](https://hackmd.io/_uploads/Syz8wUajC.png) +- **Delete:** Click a fidget then click the X icon above it to delete it forever. +![image](https://hackmd.io/_uploads/SyhwvLpoR.png) + +### Customize Theme +- **Templates:** One quick and easy option is to select a template. Then if you'd like, you can further customize to make it your own. +- **Style:** Set a background color or gradient for each Tab, or set the default color, border, and shadows for all Fidgets on the selected Tab. +- **Fonts:** Set the default header and body fonts for Fidgets on your space. +- **Code:** Add HTML/CSS to fully customize your space's background. + +![Edit Theme](https://hackmd.io/_uploads/Sk7sWw6sC.gif) + +### Customize Music +Last but not least, search for or paste the link to any song or playlist on YouTube to play it for yourself on your homebase or on your space for your friends. + +### Homebase vs. Space +**Your Homebase** is a private space that only you can see. + +**Your Space** is your public profile that everyone can see. + +You can use the same Fidgets and tricks to customize them both. Use your **Homebase** to access the content, communities, and functionality that you love, and use your **Space** to share the content and functionality you love with your friends. + +`; +const onboardingFidgetID = "text:onboarding"; +const onboardingFidgetConfig = { + config: { + editable: true, + settings: { + title: "Welcome to Nounspace! 🚀 👾", + text: tutorialText, + urlColor: "blue", + fontFamily: "Londrina Solid", + fontColor: "#073b4c", + headingsFontFamily: "Londrina Solid", + headingsFontColor: "#2563ea", + backgroundColor: "#06d6a0", + borderColor: "#ffd166", + }, + data: {}, + }, + fidgetType: "text", + id: onboardingFidgetID, +}; const layoutID = ""; const INITIAL_HOMEBASE_CONFIG: SpaceConfig = { layoutID, layoutDetails: { layoutConfig: { - layout: [], + layout: [ + // Existing layouts can go here, e.g., feed, profile, etc. + { + w: 6, + h: 7, + x: 8, + y: 3, + i: onboardingFidgetID, + moved: false, + static: false, + }, + ], }, layoutFidget: "grid", }, theme: DEFAULT_THEME, - fidgetInstanceDatums: {}, + fidgetInstanceDatums: { + [onboardingFidgetID]: onboardingFidgetConfig, + }, isEditable: true, fidgetTrayContents: [], }; From 20fe90bc940527974b9c0a0bbeee89bcdf14f597 Mon Sep 17 00:00:00 2001 From: Jesse Paterson Date: Fri, 20 Sep 2024 00:11:41 -0500 Subject: [PATCH 8/8] Update package.json (#439) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2d0b1b39..d3ad04f1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Nounspace", - "version": "0.0.10", + "version": "0.0.11", "license": "", "private": true, "scripts": {