Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import type { ComponentProps } from "svelte";
import SettingsTile from "./SettingsTile.svelte";

export default {
title: "UI/SettingsTile",
component: SettingsTile,
tags: ["autodocs"],
render: (args: {
Component: SettingsTile;
props: ComponentProps<typeof SettingsTile>;
}) => ({
Component: SettingsTile,
props: args,
}),
};

export const Primary = {
args: {
title: "Who can see your posts?",
currentStatus: "Only followers",
callback: () => alert("clicked"),
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<script lang="ts">
import { ArrowRight01Icon } from '@hugeicons/core-free-icons';
import { HugeiconsIcon } from '@hugeicons/svelte';
import type { HTMLButtonAttributes } from 'svelte/elements';

interface IAvatarProps extends HTMLButtonAttributes {
title: string;
currentStatus: 'string';
callback: () => void;
}
Copy link
Contributor

@coderabbitai coderabbitai bot Jun 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix interface name and type definition.

The interface has two issues:

  1. Interface name IAvatarProps should be ISettingsTileProps to match the component
  2. currentStatus type should be string not 'string' (literal string type)
-	interface IAvatarProps extends HTMLButtonAttributes {
+	interface ISettingsTileProps extends HTMLButtonAttributes {
 		title: string;
-		currentStatus: 'string';
+		currentStatus: string;
 		callback: () => void;
 	}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
interface IAvatarProps extends HTMLButtonAttributes {
title: string;
currentStatus: 'string';
callback: () => void;
}
interface ISettingsTileProps extends HTMLButtonAttributes {
title: string;
currentStatus: string;
callback: () => void;
}
🤖 Prompt for AI Agents
In platforms/metagram/src/lib/fragments/SettingsTile/SettingsTile.svelte around
lines 6 to 10, rename the interface from IAvatarProps to ISettingsTileProps to
match the component name, and change the type of currentStatus from the literal
type 'string' to the primitive string type string for correct typing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also why string? hard type it with statuses as mentioned like 'only-followers' | 'public' assume the enumeration for now


const { title, currentStatus, callback, ...restProps }: IAvatarProps = $props();
</script>

<button
class="flex w-full cursor-pointer items-center justify-between"
onclick={callback}
{...restProps}
>
<div class="flex flex-col items-start gap-1">
<span class="font-semibold">{title}</span>
<span class="text-black/60">{currentStatus}</span>
</div>
<HugeiconsIcon icon={ArrowRight01Icon} className="text-black/40" />
</button>
33 changes: 17 additions & 16 deletions platforms/metagram/src/lib/fragments/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
export { default as Header } from './Header/Header.svelte';
export { default as BottomNav } from './BottomNav/BottomNav.svelte';
export { default as SettingsNavigationButton } from './SettingsNavigationButton/SettingsNavigationButton.svelte';
export { default as MessageInput } from './MessageInput/MessageInput.svelte';
export { default as InputFile } from './InputFile/InputFile.svelte';
export { default as Drawer } from './Drawer/Drawer.svelte';
export { default as Message } from './Message/Message.svelte';
export { default as ActionMenu } from './ActionMenu/ActionMenu.svelte';
export { default as Modal } from './Modal/Modal.svelte';
export { default as SideBar } from './SideBar/SideBar.svelte';
export { default as RightAside } from './RightAside/RightAside.svelte';
export { default as SettingsToggleButton } from './SettingsToggleButton/SettingsToggleButton.svelte';
export { default as Post } from './Post/Post.svelte';
export { default as ChatMessage } from './ChatMessage/ChatMessage.svelte';
export { default as Comment } from './Comment/Comment.svelte';
export { default as SettingsDeleteButton } from './SettingsDeleteButton/SettingsDeleteButton.svelte';
export { default as Header } from "./Header/Header.svelte";
export { default as BottomNav } from "./BottomNav/BottomNav.svelte";
export { default as SettingsNavigationButton } from "./SettingsNavigationButton/SettingsNavigationButton.svelte";
export { default as MessageInput } from "./MessageInput/MessageInput.svelte";
export { default as InputFile } from "./InputFile/InputFile.svelte";
export { default as Drawer } from "./Drawer/Drawer.svelte";
export { default as Message } from "./Message/Message.svelte";
export { default as ActionMenu } from "./ActionMenu/ActionMenu.svelte";
export { default as Modal } from "./Modal/Modal.svelte";
export { default as SideBar } from "./SideBar/SideBar.svelte";
export { default as RightAside } from "./RightAside/RightAside.svelte";
export { default as SettingsToggleButton } from "./SettingsToggleButton/SettingsToggleButton.svelte";
export { default as Post } from "./Post/Post.svelte";
export { default as ChatMessage } from "./ChatMessage/ChatMessage.svelte";
export { default as Comment } from "./Comment/Comment.svelte";
export { default as SettingsDeleteButton } from "./SettingsDeleteButton/SettingsDeleteButton.svelte";
export { default as SettingsTile } from "./SettingsTile/SettingsTile.svelte";