Skip to content

Commit 7075f6d

Browse files
author
github-actions-bot
committed
Deploy registry
1 parent 8fccdf6 commit 7075f6d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

r/atomic-crm.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@
360360
},
361361
{
362362
"path": "src/components/atomic-crm/notes/NoteInputs.tsx",
363-
"content": "import { useState } from \"react\";\nimport { useFormContext } from \"react-hook-form\";\nimport { TextInput } from \"@/components/admin/text-input\";\nimport { FileInput } from \"@/components/admin/file-input\";\nimport { FileField } from \"@/components/admin/file-field\";\nimport { SelectInput } from \"@/components/admin/select-input\";\nimport { Button } from \"@/components/ui/button\";\nimport { cn } from \"@/lib/utils.ts\";\n\nimport { Status } from \"../misc/Status\";\nimport { useConfigurationContext } from \"../root/ConfigurationContext\";\nimport { getCurrentDate } from \"./utils\";\n\nexport const NoteInputs = ({ showStatus }: { showStatus?: boolean }) => {\n const { noteStatuses } = useConfigurationContext();\n const { setValue } = useFormContext();\n const [displayMore, setDisplayMore] = useState(false);\n\n return (\n <div className=\"space-y-2\">\n <TextInput\n source=\"text\"\n label={false}\n multiline\n helperText={false}\n placeholder=\"Add a note\"\n />\n\n {!displayMore && (\n <div className=\"flex justify-end items-center gap-2\">\n <Button\n variant=\"link\"\n size=\"sm\"\n onClick={() => {\n setDisplayMore(!displayMore);\n setValue(\"date\", getCurrentDate());\n }}\n className=\"text-sm text-muted-foreground underline hover:no-underline p-0 h-auto cursor-pointer\"\n >\n Show options\n </Button>\n <span className=\"text-sm text-muted-foreground\">\n (attach files, or change details)\n </span>\n </div>\n )}\n\n <div\n className={cn(\n \"space-y-3 mt-3 overflow-hidden transition-transform ease-in-out duration-300 origin-top\",\n !displayMore ? \"scale-y-0 max-h-0 h-0\" : \"scale-y-100\",\n )}\n >\n <div className=\"flex gap-4\">\n {showStatus && (\n <SelectInput\n source=\"status\"\n choices={noteStatuses.map((status) => ({\n id: status.value,\n name: status.label,\n value: status.value,\n }))}\n optionText={optionRenderer}\n defaultValue={\"warm\"}\n helperText={false}\n />\n )}\n <TextInput\n source=\"date\"\n label=\"Date\"\n helperText={false}\n type=\"datetime-local\"\n className=\"text-primary\"\n defaultValue={new Date().toISOString().slice(0, 16)}\n />\n </div>\n <FileInput source=\"attachments\" multiple>\n <FileField source=\"src\" title=\"title\" target=\"_blank\" />\n </FileInput>\n </div>\n </div>\n );\n};\n\nconst optionRenderer = (choice: any) => {\n return (\n <div>\n <Status status={choice.value} /> {choice.name}\n </div>\n );\n};\n",
363+
"content": "import { useState } from \"react\";\nimport { useFormContext } from \"react-hook-form\";\nimport { TextInput } from \"@/components/admin/text-input\";\nimport { FileInput } from \"@/components/admin/file-input\";\nimport { FileField } from \"@/components/admin/file-field\";\nimport { SelectInput } from \"@/components/admin/select-input\";\nimport { Button } from \"@/components/ui/button\";\nimport { cn } from \"@/lib/utils.ts\";\n\nimport { Status } from \"../misc/Status\";\nimport { useConfigurationContext } from \"../root/ConfigurationContext\";\nimport { getCurrentDate } from \"./utils\";\n\nexport const NoteInputs = ({ showStatus }: { showStatus?: boolean }) => {\n const { noteStatuses } = useConfigurationContext();\n const { setValue } = useFormContext();\n const [displayMore, setDisplayMore] = useState(false);\n\n return (\n <div className=\"space-y-2\">\n <TextInput\n source=\"text\"\n label={false}\n multiline\n helperText={false}\n placeholder=\"Add a note\"\n rows={6}\n />\n\n {!displayMore && (\n <div className=\"flex justify-end items-center gap-2\">\n <Button\n variant=\"link\"\n size=\"sm\"\n onClick={() => {\n setDisplayMore(!displayMore);\n setValue(\"date\", getCurrentDate());\n }}\n className=\"text-sm text-muted-foreground underline hover:no-underline p-0 h-auto cursor-pointer\"\n >\n Show options\n </Button>\n <span className=\"text-sm text-muted-foreground\">\n (attach files, or change details)\n </span>\n </div>\n )}\n\n <div\n className={cn(\n \"space-y-3 mt-3 overflow-hidden transition-transform ease-in-out duration-300 origin-top\",\n !displayMore ? \"scale-y-0 max-h-0 h-0\" : \"scale-y-100\",\n )}\n >\n <div className=\"flex gap-4\">\n {showStatus && (\n <SelectInput\n source=\"status\"\n choices={noteStatuses.map((status) => ({\n id: status.value,\n name: status.label,\n value: status.value,\n }))}\n optionText={optionRenderer}\n defaultValue={\"warm\"}\n helperText={false}\n />\n )}\n <TextInput\n source=\"date\"\n label=\"Date\"\n helperText={false}\n type=\"datetime-local\"\n className=\"text-primary\"\n defaultValue={new Date().toISOString().slice(0, 16)}\n />\n </div>\n <FileInput source=\"attachments\" multiple>\n <FileField source=\"src\" title=\"title\" target=\"_blank\" />\n </FileInput>\n </div>\n </div>\n );\n};\n\nconst optionRenderer = (choice: any) => {\n return (\n <div>\n <Status status={choice.value} /> {choice.name}\n </div>\n );\n};\n",
364364
"type": "registry:component"
365365
},
366366
{
@@ -375,7 +375,7 @@
375375
},
376376
{
377377
"path": "src/components/atomic-crm/notes/Note.tsx",
378-
"content": "import { CircleX, Edit, Save, Trash2 } from \"lucide-react\";\nimport {\n Form,\n useDelete,\n useNotify,\n useResourceContext,\n useUpdate,\n WithRecord,\n} from \"ra-core\";\nimport { useState } from \"react\";\nimport type { FieldValues, SubmitHandler } from \"react-hook-form\";\nimport { ReferenceField } from \"@/components/admin/reference-field\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from \"@/components/ui/tooltip\";\n\nimport { CompanyAvatar } from \"../companies/CompanyAvatar\";\nimport { Avatar } from \"../contacts/Avatar\";\nimport { RelativeDate } from \"../misc/RelativeDate\";\nimport { Status } from \"../misc/Status\";\nimport { SaleName } from \"../sales/SaleName\";\nimport type { ContactNote, DealNote } from \"../types\";\nimport { NoteAttachments } from \"./NoteAttachments\";\nimport { NoteInputs } from \"./NoteInputs\";\n\nexport const Note = ({\n showStatus,\n note,\n}: {\n showStatus?: boolean;\n note: DealNote | ContactNote;\n isLast: boolean;\n}) => {\n const [isHover, setHover] = useState(false);\n const [isEditing, setEditing] = useState(false);\n const resource = useResourceContext();\n const notify = useNotify();\n\n const [update, { isPending }] = useUpdate();\n\n const [deleteNote] = useDelete(\n resource,\n { id: note.id, previousData: note },\n {\n mutationMode: \"undoable\",\n onSuccess: () => {\n notify(\"Note deleted\", { type: \"info\", undoable: true });\n },\n },\n );\n\n const handleDelete = () => {\n deleteNote();\n };\n\n const handleEnterEditMode = () => {\n setEditing(!isEditing);\n };\n\n const handleCancelEdit = () => {\n setEditing(false);\n setHover(false);\n };\n\n const handleNoteUpdate: SubmitHandler<FieldValues> = (values) => {\n update(\n resource,\n { id: note.id, data: values, previousData: note },\n {\n onSuccess: () => {\n setEditing(false);\n setHover(false);\n },\n },\n );\n };\n\n return (\n <div\n onMouseEnter={() => setHover(true)}\n onMouseLeave={() => setHover(false)}\n >\n <div className=\"flex items-center space-x-4 w-full\">\n {resource === \"contactNote\" ? (\n <Avatar width={20} height={20} />\n ) : (\n <ReferenceField source=\"company_id\" reference=\"companies\" link=\"show\">\n <CompanyAvatar width={20} height={20} />\n </ReferenceField>\n )}\n <div className=\"inline-flex h-full items-center text-sm text-muted-foreground\">\n <ReferenceField\n record={note}\n resource={resource}\n source=\"sales_id\"\n reference=\"sales\"\n link={false}\n >\n <WithRecord render={(record) => <SaleName sale={record} />} />\n </ReferenceField>{\" \"}\n added a note{\" \"}\n {showStatus && note.status && (\n <Status className=\"ml-2\" status={note.status} />\n )}\n </div>\n <span className={`${isHover ? \"visible\" : \"invisible\"}`}>\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={handleEnterEditMode}\n className=\"p-1 h-auto cursor-pointer\"\n >\n <Edit className=\"w-4 h-4\" />\n </Button>\n </TooltipTrigger>\n <TooltipContent>\n <p>Edit note</p>\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={handleDelete}\n className=\"p-1 h-auto cursor-pointer\"\n >\n <Trash2 className=\"w-4 h-4\" />\n </Button>\n </TooltipTrigger>\n <TooltipContent>\n <p>Delete note</p>\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n </span>\n <div className=\"flex-1\"></div>\n <span className=\"text-sm text-muted-foreground\">\n <RelativeDate date={note.date} />\n </span>\n </div>\n {isEditing ? (\n <Form onSubmit={handleNoteUpdate} record={note}>\n <NoteInputs showStatus={showStatus} />\n <div className=\"flex justify-end mt-4 space-x-4\">\n <Button\n variant=\"ghost\"\n onClick={handleCancelEdit}\n type=\"button\"\n className=\"cursor-pointer\"\n >\n <CircleX className=\"w-4 h-4\" />\n Cancel\n </Button>\n <Button\n type=\"submit\"\n disabled={isPending}\n className=\"flex items-center gap-2 cursor-pointer\"\n >\n <Save className=\"w-4 h-4\" />\n Update note\n </Button>\n </div>\n </Form>\n ) : (\n <div className=\"pt-2 [&_p:empty]:min-h-[0.75em]\">\n {note.text?.split(\"\\n\").map((paragraph: string, index: number) => (\n <p className=\"text-sm leading-6 m-0\" key={index}>\n {paragraph}\n </p>\n ))}\n\n {note.attachments && <NoteAttachments note={note} />}\n </div>\n )}\n </div>\n );\n};\n",
378+
"content": "import { CircleX, Edit, Save, Trash2 } from \"lucide-react\";\nimport {\n Form,\n useDelete,\n useNotify,\n useResourceContext,\n useUpdate,\n WithRecord,\n} from \"ra-core\";\nimport { useState } from \"react\";\nimport type { FieldValues, SubmitHandler } from \"react-hook-form\";\nimport { ReferenceField } from \"@/components/admin/reference-field\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from \"@/components/ui/tooltip\";\n\nimport { CompanyAvatar } from \"../companies/CompanyAvatar\";\nimport { Avatar } from \"../contacts/Avatar\";\nimport { RelativeDate } from \"../misc/RelativeDate\";\nimport { Status } from \"../misc/Status\";\nimport { SaleName } from \"../sales/SaleName\";\nimport type { ContactNote, DealNote } from \"../types\";\nimport { NoteAttachments } from \"./NoteAttachments\";\nimport { NoteInputs } from \"./NoteInputs\";\n\nexport const Note = ({\n showStatus,\n note,\n}: {\n showStatus?: boolean;\n note: DealNote | ContactNote;\n isLast: boolean;\n}) => {\n const [isHover, setHover] = useState(false);\n const [isEditing, setEditing] = useState(false);\n const resource = useResourceContext();\n const notify = useNotify();\n\n const [update, { isPending }] = useUpdate();\n\n const [deleteNote] = useDelete(\n resource,\n { id: note.id, previousData: note },\n {\n mutationMode: \"undoable\",\n onSuccess: () => {\n notify(\"Note deleted\", { type: \"info\", undoable: true });\n },\n },\n );\n\n const handleDelete = () => {\n deleteNote();\n };\n\n const handleEnterEditMode = () => {\n setEditing(!isEditing);\n };\n\n const handleCancelEdit = () => {\n setEditing(false);\n setHover(false);\n };\n\n const handleNoteUpdate: SubmitHandler<FieldValues> = (values) => {\n update(\n resource,\n { id: note.id, data: values, previousData: note },\n {\n onSuccess: () => {\n setEditing(false);\n setHover(false);\n },\n },\n );\n };\n\n return (\n <div\n onMouseEnter={() => setHover(true)}\n onMouseLeave={() => setHover(false)}\n >\n <div className=\"flex items-center space-x-4 w-full\">\n {resource === \"contactNote\" ? (\n <Avatar width={20} height={20} />\n ) : (\n <ReferenceField source=\"company_id\" reference=\"companies\" link=\"show\">\n <CompanyAvatar width={20} height={20} />\n </ReferenceField>\n )}\n <div className=\"inline-flex h-full items-center text-sm text-muted-foreground\">\n <ReferenceField\n record={note}\n resource={resource}\n source=\"sales_id\"\n reference=\"sales\"\n link={false}\n >\n <WithRecord render={(record) => <SaleName sale={record} />} />\n </ReferenceField>{\" \"}\n added a note{\" \"}\n {showStatus && note.status && (\n <Status className=\"ml-2\" status={note.status} />\n )}\n </div>\n <span className={`${isHover ? \"visible\" : \"invisible\"}`}>\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={handleEnterEditMode}\n className=\"p-1 h-auto cursor-pointer\"\n >\n <Edit className=\"w-4 h-4\" />\n </Button>\n </TooltipTrigger>\n <TooltipContent>\n <p>Edit note</p>\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={handleDelete}\n className=\"p-1 h-auto cursor-pointer\"\n >\n <Trash2 className=\"w-4 h-4\" />\n </Button>\n </TooltipTrigger>\n <TooltipContent>\n <p>Delete note</p>\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n </span>\n <div className=\"flex-1\"></div>\n <span className=\"text-sm text-muted-foreground\">\n <RelativeDate date={note.date} />\n </span>\n </div>\n {isEditing ? (\n <Form onSubmit={handleNoteUpdate} record={note} className=\"mt-1\">\n <NoteInputs showStatus={showStatus} />\n <div className=\"flex justify-end mt-2 space-x-4\">\n <Button\n variant=\"ghost\"\n onClick={handleCancelEdit}\n type=\"button\"\n className=\"cursor-pointer\"\n >\n <CircleX className=\"w-4 h-4\" />\n Cancel\n </Button>\n <Button\n type=\"submit\"\n disabled={isPending}\n className=\"flex items-center gap-2 cursor-pointer\"\n >\n <Save className=\"w-4 h-4\" />\n Update note\n </Button>\n </div>\n </Form>\n ) : (\n <div className=\"pt-2 [&_p:empty]:min-h-[0.75em]\">\n {note.text?.split(\"\\n\").map((paragraph: string, index: number) => (\n <p className=\"text-sm leading-6 m-0\" key={index}>\n {paragraph}\n </p>\n ))}\n\n {note.attachments && <NoteAttachments note={note} />}\n </div>\n )}\n </div>\n );\n};\n",
379379
"type": "registry:component"
380380
},
381381
{

0 commit comments

Comments
 (0)