Skip to content
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
6 changes: 2 additions & 4 deletions apps/code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@
"@posthog/electron-trpc": "workspace:*",
"@posthog/git": "workspace:*",
"@posthog/hedgehog-mode": "^0.0.48",
"@posthog/quill-blocks": "link:/Users/adamleithp/Dev/posthog/packages/quill/packages/blocks",
"@posthog/quill-components": "link:/Users/adamleithp/Dev/posthog/packages/quill/packages/components",
"@posthog/quill-primitives": "link:/Users/adamleithp/Dev/posthog/packages/quill/packages/primitives",
"@posthog/quill-tokens": "link:/Users/adamleithp/Dev/posthog/packages/quill/packages/tokens",
"@posthog/quill": "0.1.0-alpha.6",
"@posthog/shared": "workspace:*",
"@radix-ui/react-collapsible": "^1.1.12",
"@radix-ui/react-icons": "^1.3.2",
Expand Down Expand Up @@ -190,6 +187,7 @@
"rehype-sanitize": "^6.0.0",
"remark-breaks": "^4.0.0",
"remark-gfm": "^4.0.1",
"shadcn": "^4.1.2",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

would it make sense to put this into the pnpm catalog?

"smol-toml": "^1.6.0",
"sonner": "^2.0.7",
"striptags": "^3.2.0",
Expand Down
7 changes: 4 additions & 3 deletions apps/code/src/renderer/components/ui/KeyHint.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Kbd } from "@posthog/quill";
import type React from "react";

interface KeyHintProps {
Expand All @@ -7,7 +8,7 @@ interface KeyHintProps {

export function KeyHint({ children, style }: KeyHintProps) {
return (
<kbd
<Kbd
style={{
display: "inline-flex",
alignItems: "center",
Expand All @@ -17,7 +18,7 @@ export function KeyHint({ children, style }: KeyHintProps) {
...style,
}}
>
{children}
</kbd>
{children as string}
</Kbd>
);
}
122 changes: 61 additions & 61 deletions apps/code/src/renderer/features/command/components/Command.tsx
Original file line number Diff line number Diff line change
@@ -1,161 +1,161 @@
import { Command as CmdkCommand } from "cmdk";
import {
CommandDialog,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
CommandRoot,
} from "cmdk";
import React from "react";
import "./Command.css";

interface CommandRootProps extends React.ComponentProps<typeof CmdkCommand> {
type CommandRootProps = React.ComponentPropsWithoutRef<typeof CommandRoot> & {
className?: string;
}
};

const CommandRoot = React.forwardRef<
React.ElementRef<typeof CmdkCommand>,
const CommandRootWrapper = React.forwardRef<
React.ElementRef<typeof CommandRoot>,
CommandRootProps
>(({ className, ...props }, ref) => {
return (
<CmdkCommand
<CommandRoot
ref={ref}
className={`flex h-full w-full flex-col overflow-hidden ${className || ""}`}
{...props}
/>
);
});

CommandRoot.displayName = "CommandRoot";
CommandRootWrapper.displayName = "CommandRoot";

interface CommandInputProps
extends React.ComponentProps<typeof CmdkCommand.Input> {
type CommandInputProps = React.ComponentPropsWithoutRef<typeof CommandInput> & {
className?: string;
}
};

const CommandInput = React.forwardRef<
React.ElementRef<typeof CmdkCommand.Input>,
const CommandInputWrapper = React.forwardRef<
React.ElementRef<typeof CommandInput>,
CommandInputProps
>(({ className, ...props }, ref) => {
return <CmdkCommand.Input ref={ref} className={className} {...props} />;
return <CommandInput ref={ref} className={className} {...props} />;
});

CommandInput.displayName = "CommandInput";
CommandInputWrapper.displayName = "CommandInput";

interface CommandListProps
extends React.ComponentProps<typeof CmdkCommand.List> {
type CommandListProps = React.ComponentPropsWithoutRef<typeof CommandList> & {
className?: string;
}
};

const CommandList = React.forwardRef<
React.ElementRef<typeof CmdkCommand.List>,
const CommandListWrapper = React.forwardRef<
React.ElementRef<typeof CommandList>,
CommandListProps
>(({ className, ...props }, ref) => {
return (
<CmdkCommand.List
<CommandList
ref={ref}
className={`overflow-y-auto ${className || ""}`}
{...props}
/>
);
});

CommandList.displayName = "CommandList";
CommandListWrapper.displayName = "CommandList";

interface CommandItemProps
extends React.ComponentProps<typeof CmdkCommand.Item> {
type CommandItemProps = React.ComponentPropsWithoutRef<typeof CommandItem> & {
className?: string;
}
};

const CommandItem = React.forwardRef<
React.ElementRef<typeof CmdkCommand.Item>,
const CommandItemWrapper = React.forwardRef<
React.ElementRef<typeof CommandItem>,
CommandItemProps
>(({ className, ...props }, ref) => {
return (
<CmdkCommand.Item
<CommandItem
ref={ref}
className={`relative flex cursor-pointer select-none items-center px-3 py-2 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent-3 data-[disabled=true]:opacity-50 ${className || ""}`}
{...props}
/>
);
});

CommandItem.displayName = "CommandItem";
CommandItemWrapper.displayName = "CommandItem";

interface CommandGroupProps
extends React.ComponentProps<typeof CmdkCommand.Group> {
type CommandGroupProps = React.ComponentPropsWithoutRef<typeof CommandGroup> & {
className?: string;
heading?: string;
}
};

const CommandGroup = React.forwardRef<
React.ElementRef<typeof CmdkCommand.Group>,
const CommandGroupWrapper = React.forwardRef<
React.ElementRef<typeof CommandGroup>,
CommandGroupProps
>(({ className, heading, children, ...props }, ref) => {
return (
<CmdkCommand.Group
ref={ref}
className={`p-1 ${className || ""}`}
{...props}
>
<CommandGroup ref={ref} className={`p-1 ${className || ""}`} {...props}>
{heading && (
<div className="px-2 py-1.5 text-gray-11" style={{ fontSize: "14px" }}>
{heading}
</div>
)}
{children}
</CmdkCommand.Group>
</CommandGroup>
);
});

CommandGroup.displayName = "CommandGroup";
CommandGroupWrapper.displayName = "CommandGroup";

interface CommandEmptyProps
extends React.ComponentProps<typeof CmdkCommand.Empty> {
type CommandEmptyProps = React.ComponentPropsWithoutRef<typeof CommandEmpty> & {
className?: string;
}
};

const CommandEmpty = React.forwardRef<
React.ElementRef<typeof CmdkCommand.Empty>,
const CommandEmptyWrapper = React.forwardRef<
React.ElementRef<typeof CommandEmpty>,
CommandEmptyProps
>(({ className, ...props }, ref) => {
return (
<CmdkCommand.Empty
<CommandEmpty
ref={ref}
className={`py-6 text-center text-sm ${className || ""}`}
{...props}
/>
);
});

CommandEmpty.displayName = "CommandEmpty";
CommandEmptyWrapper.displayName = "CommandEmpty";

interface CommandDialogProps
extends React.ComponentProps<typeof CmdkCommand.Dialog> {
type CommandDialogProps = React.ComponentPropsWithoutRef<
typeof CommandDialog
> & {
className?: string;
contentClassName?: string;
}
};

const CommandDialog = ({
const CommandDialogWrapper = ({
className,
contentClassName,
children,
...props
}: CommandDialogProps) => {
return (
<CmdkCommand.Dialog
<CommandDialog
label="Command menu"
className={className}
contentClassName={`command-dialog-content ${contentClassName || ""}`}
overlayClassName="command-dialog-overlay"
{...props}
>
{children}
</CmdkCommand.Dialog>
</CommandDialog>
);
};

CommandDialog.displayName = "CommandDialog";
CommandDialogWrapper.displayName = "CommandDialog";

export const Command = {
Root: CommandRoot,
Dialog: CommandDialog,
Input: CommandInput,
List: CommandList,
Item: CommandItem,
Group: CommandGroup,
Empty: CommandEmpty,
Root: CommandRootWrapper,
Dialog: CommandDialogWrapper,
Input: CommandInputWrapper,
List: CommandListWrapper,
Item: CommandItemWrapper,
Group: CommandGroupWrapper,
Empty: CommandEmptyWrapper,
};
Loading
Loading