Skip to content

Commit

Permalink
Fixing embedded feed for new users (#393)
Browse files Browse the repository at this point in the history
Co-authored-by: sktbrd <[email protected]>
  • Loading branch information
j-paterson and sktbrd authored Sep 1, 2024
1 parent ad76c97 commit 78b130b
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 27 deletions.
7 changes: 4 additions & 3 deletions src/common/components/molecules/LinksInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ const LinksInput = forwardRef<HTMLInputElement, LinksInputProps>(
const newLink = {
text: "New Link",
url: "https://",
avatar: "/images/chainEmoji.png",
avatar: "https://www.nounspace.com/images/chainEmoji.png",
description: "Description",
};

onChange?.([...value, newLink]);
setVisibleFields([...visibleFields, true]); // Automatically expand new link
setVisibleFields([...visibleFields, true]);
};

const removeLink = (index: number) => {
Expand Down Expand Up @@ -133,8 +133,9 @@ const LinksInput = forwardRef<HTMLInputElement, LinksInputProps>(
value={link.url}
onChange={(e: any) => {
handleLinkChange(index, { ...link, url: e.target.value });
showAdditionalFields(index); // Show fields when URL is updated
showAdditionalFields(index);
}}
onFocus={() => showAdditionalFields(index)}
/>
<TextFieldSlot>
<p
Expand Down
6 changes: 3 additions & 3 deletions src/fidgets/farcaster/Feed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const feedProperties: FidgetProperties<FeedFidgetSettings> = {
displayName: "Select App",
inputSelector: PlatformSelector,
required: false,
default: { name: "farcaster", icon: "/images/farcaster.jpeg" },
default: { name: "Farcaster", icon: "/images/farcaster.jpeg" },
},
{
fieldName: "feedType",
Expand All @@ -109,7 +109,7 @@ const feedProperties: FidgetProperties<FeedFidgetSettings> = {
displayName: "Username",
inputSelector: TextInput,
required: false,
disabledIf: (settings) => settings.selectPlatform.name === "Farcaster",
disabledIf: (settings) => settings.selectPlatform.name === "farcaster",
default: "thenounspace",
},
{
Expand Down Expand Up @@ -206,7 +206,7 @@ export const FEED_TYPES = [

const Feed: React.FC<FidgetArgs<FeedFidgetSettings>> = ({ settings }) => {
const {
selectPlatform = { name: "farcaster", icon: "/images/farcaster.jpeg" },
selectPlatform = { name: "Farcaster", icon: "/images/farcaster.jpeg" },
Xhandle,
style,
} = settings;
Expand Down
37 changes: 21 additions & 16 deletions src/fidgets/ui/Links.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import CSSInput from "@/common/components/molecules/CSSInput";
import ColorSelector from "@/common/components/molecules/ColorSelector";
import FontSelector from "@/common/components/molecules/FontSelector";
import { FidgetArgs, FidgetProperties, FidgetModule } from "@/common/fidgets";
import { defaultStyleFields } from "../helpers";
import { FidgetSettingsStyle } from "@/common/fidgets";
import {
CardHeader,
Expand Down Expand Up @@ -37,6 +36,8 @@ export type LinkFidgetSettings = {
itemBackground: string;
viewMode: ViewMode;
description?: string;
DescriptionColor: string;
HeaderColor: string;
} & FidgetSettingsStyle;

export const linkConfig: FidgetProperties = {
Expand All @@ -56,7 +57,7 @@ export const linkConfig: FidgetProperties = {
{
text: "Nouns",
url: "https://nouns.wtf",
avatar: "/images/nouns.svg",
avatar: "https://nouns.wtf/static/media/noggles.7644bfd0.svg",
description: "Funds ideas",
},
],
Expand All @@ -66,7 +67,7 @@ export const linkConfig: FidgetProperties = {
},
{
fieldName: "viewMode",
default: "grid",
default: "list",
required: false,
inputSelector: SwitchButton,
group: "style",
Expand All @@ -79,7 +80,14 @@ export const linkConfig: FidgetProperties = {
group: "style",
},
{
fieldName: "fontColor",
fieldName: "HeaderColor",
default: "black",
required: false,
inputSelector: ColorSelector,
group: "style",
},
{
fieldName: "DescriptionColor",
default: "black",
required: false,
inputSelector: ColorSelector,
Expand Down Expand Up @@ -129,9 +137,9 @@ export const linkConfig: FidgetProperties = {
},
],
size: {
minHeight: 1,
minHeight: 2,
maxHeight: 36,
minWidth: 4,
minWidth: 2,
maxWidth: 36,
},
};
Expand All @@ -141,12 +149,7 @@ export const Links: React.FC<FidgetArgs<LinkFidgetSettings>> = ({
}) => {
const links = Array.isArray(settings.links) ? settings.links : [];
const isGridView = settings.viewMode === "grid";
useEffect(() => {
console.log("Links fidget settings:", settings.links);
}, [settings.links]);
useEffect(() => {
console.log("Links fidget settings:", settings.links);
}, [settings.links]);

return (
<div
style={{
Expand All @@ -159,6 +162,7 @@ export const Links: React.FC<FidgetArgs<LinkFidgetSettings>> = ({
overflow: "auto",
scrollbarWidth: "none",
padding: "0.5rem",
borderRadius: "1rem",
}}
>
{settings?.title && (
Expand All @@ -167,7 +171,7 @@ export const Links: React.FC<FidgetArgs<LinkFidgetSettings>> = ({
className="text-2xl font-bold"
style={{
fontFamily: settings.headingsFontFamily,
color: settings.fontColor,
color: settings.HeaderColor,
}}
>
{settings.title}
Expand Down Expand Up @@ -229,12 +233,12 @@ export const Links: React.FC<FidgetArgs<LinkFidgetSettings>> = ({
className="items-start text-base font-normal text-black dark:text-white flex-grow"
style={{
fontFamily: settings.fontFamily,
color: settings.fontColor,
color: settings.HeaderColor,
textAlign: "left",
wordWrap: "break-word",
overflow: "hidden",
textOverflow: "ellipsis",
maxHeight: "3rem", // Adjust this value to limit the height of the text
maxHeight: "3rem",
display: "-webkit-box",
WebkitLineClamp: 2,
WebkitBoxOrient: "vertical",
Expand All @@ -248,11 +252,12 @@ export const Links: React.FC<FidgetArgs<LinkFidgetSettings>> = ({
</CardDescription>
{link.description && (
<p
className="text-sm font-normal text-gray-500 dark:text-gray-400"
className="text-sm font-normal"
style={{
wordWrap: "break-word",
overflow: "hidden",
textOverflow: "ellipsis",
color: settings.DescriptionColor,
}}
>
{link.description}
Expand Down
6 changes: 3 additions & 3 deletions src/pages/homebase/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ const Homebase: NextPageWithLayout = () => {
args.feed = (
<FeedModule.fidget
settings={{
feedType: FeedType.Filter,
users: String(currentFid),
feedType: FeedType.Following,
users: "",
filterType: FilterType.Users,
selectPlatform: { name: "farcaster", icon: "/images/farcaster.jpeg" },
selectPlatform: { name: "Farcaster", icon: "/images/farcaster.jpeg" },
Xhandle: "",
style: "",
}}
Expand Down
2 changes: 0 additions & 2 deletions supabase/migrations/20240821215436_spaceOrderings.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ create table "public"."spaceOrderings" (

alter table "public"."spaceOrderings" enable row level security;

alter table "public"."spaceRegistrations" drop column "isDefault";

CREATE INDEX "fidRegistrations_fid_idx" ON public."fidRegistrations" USING btree (fid);

CREATE UNIQUE INDEX "spaceOrderings_pkey" ON public."spaceOrderings" USING btree (id);
Expand Down

0 comments on commit 78b130b

Please sign in to comment.