From 200b3bcf464012b6b4307026c81344a96aab100c Mon Sep 17 00:00:00 2001 From: Nirmit Pandya Date: Sun, 29 Dec 2024 17:28:24 +0530 Subject: [PATCH 1/6] feat: multi-select field type --- extensions/twenty/CHANGELOG.md | 4 ++ .../twenty/src/components/FieldComponent.tsx | 7 +++ .../twenty/src/components/MultiSelect.tsx | 48 +++++++++++++++++++ extensions/twenty/src/helper/formatValues.ts | 6 +++ 4 files changed, 65 insertions(+) create mode 100644 extensions/twenty/src/components/MultiSelect.tsx diff --git a/extensions/twenty/CHANGELOG.md b/extensions/twenty/CHANGELOG.md index 9673997772fcb..bfc7d61221ec6 100644 --- a/extensions/twenty/CHANGELOG.md +++ b/extensions/twenty/CHANGELOG.md @@ -1,5 +1,9 @@ # Twenty Changelog +## [Enhancements] - {PR_MERGE_DATE} + +- Added support for multi-select field type + ## [Enhancements] - 2024-12-18 - Updated select field type with preference diff --git a/extensions/twenty/src/components/FieldComponent.tsx b/extensions/twenty/src/components/FieldComponent.tsx index 6fd8421f92d3b..a44dea9bb4eed 100644 --- a/extensions/twenty/src/components/FieldComponent.tsx +++ b/extensions/twenty/src/components/FieldComponent.tsx @@ -3,6 +3,7 @@ import { DataModelField } from "../services/zod/schema/recordFieldSchema"; import TextInput from "./TextInput"; import Select from "./Select"; import Rating from "./Rating"; +import MultiSelect from "./MultiSelect"; type FieldComponentProps = { values: { @@ -25,6 +26,12 @@ export default function FieldComponent({ values }: FieldComponentProps) { case "RATING": { return ; } + case "MULTI_SELECT": { + return ; + } + // case "MULTI_SELECT": { + // return ; + // } default: return <>; } diff --git a/extensions/twenty/src/components/MultiSelect.tsx b/extensions/twenty/src/components/MultiSelect.tsx new file mode 100644 index 0000000000000..c57fba3d31956 --- /dev/null +++ b/extensions/twenty/src/components/MultiSelect.tsx @@ -0,0 +1,48 @@ +import React, { forwardRef } from "react"; +import { Form, FormItemRef } from "@raycast/api"; +import { DataModelField } from "../services/zod/schema/recordFieldSchema"; +import { optionIcons } from "../enum/icons"; + +type MultiSelectProps = { + field: DataModelField; +}; + +// Use forwardRef for consistency and ref handling +const MultiSelect = forwardRef>( + ({ values, ...rest }, ref) => { + const { field } = values; + const { options } = field; + + const defaultValue = Array.isArray(field.defaultValue) + ? field.defaultValue.map((value) => value.replace(/^'|'$/g, "").trim()) + : field.defaultValue + ? [field.defaultValue.replace(/^'|'$/g, "").trim()] + : []; + + const { id, value, ...modifiedRest } = rest; // eslint-disable-line @typescript-eslint/no-unused-vars + + return ( + } + {...modifiedRest} + > + {options?.map((option) => ( + + ))} + + ); + }, +); + +// Set display name for better debugging +MultiSelect.displayName = "MultiSelect"; + +export default MultiSelect; diff --git a/extensions/twenty/src/helper/formatValues.ts b/extensions/twenty/src/helper/formatValues.ts index 341df646bd8c2..fd1293147097b 100644 --- a/extensions/twenty/src/helper/formatValues.ts +++ b/extensions/twenty/src/helper/formatValues.ts @@ -36,6 +36,12 @@ export function formatValues(values: Record, objectRecordMetadata: } break; } + case "MULTI_SELECT": { + if (formattedValues[key] === "") { + formattedValues[key] = null; + } + break; + } default: break; } From 2373f3bba5473ff01a93d7e5f5937d8a666ef234 Mon Sep 17 00:00:00 2001 From: LitoMore Date: Mon, 30 Dec 2024 17:43:40 +0800 Subject: [PATCH 2/6] [Brand Icons] Fix incorrect file path (#16059) --- extensions/simple-icons/CHANGELOG.md | 7 ++++++- extensions/simple-icons/package.json | 9 +++++++++ extensions/simple-icons/src/actions.tsx | 8 ++++++++ extensions/simple-icons/src/index.tsx | 8 +++++++- extensions/simple-icons/src/types.ts | 1 + extensions/simple-icons/src/utils.ts | 14 ++++++-------- 6 files changed, 37 insertions(+), 10 deletions(-) diff --git a/extensions/simple-icons/CHANGELOG.md b/extensions/simple-icons/CHANGELOG.md index 334125cae581e..3a2d5b88a1381 100644 --- a/extensions/simple-icons/CHANGELOG.md +++ b/extensions/simple-icons/CHANGELOG.md @@ -1,6 +1,11 @@ # Brand Icons Changelog -## [Maintenance] - {PR_MERGE_DATE} +## [Enhancements & Fixes] - 2024-10-28 + +- Fix incorrect file path +- Add support for copying font entities + +## [Maintenance] - 2024-10-27 - Get ready for the v14 new data structure - Add support for copying icon title diff --git a/extensions/simple-icons/package.json b/extensions/simple-icons/package.json index 26794c39afd35..5c806478da53c 100644 --- a/extensions/simple-icons/package.json +++ b/extensions/simple-icons/package.json @@ -89,6 +89,15 @@ "required": false, "type": "checkbox", "default": true + }, + { + "name": "displaySimpleIconsFontFeatures", + "title": "Display Simple Icons Font Features", + "label": "Enabled", + "description": "Display Simple Icons Font Features, such as font Copy Character, Copy HTML Code, and Copy UTF Code", + "required": false, + "type": "checkbox", + "default": true } ], "dependencies": { diff --git a/extensions/simple-icons/src/actions.tsx b/extensions/simple-icons/src/actions.tsx index 722e828bad335..9432642283d49 100644 --- a/extensions/simple-icons/src/actions.tsx +++ b/extensions/simple-icons/src/actions.tsx @@ -47,6 +47,14 @@ export const CopyUnpkg = ({ icon, version }: ActionProps) => { return ; }; +export const CopyFontEntities = ({ icon }: ActionProps) => ( + <> + + + + +); + export const Supports = () => ( <> )} + {displaySimpleIconsFontFeatures && ( + + + + )} diff --git a/extensions/simple-icons/src/types.ts b/extensions/simple-icons/src/types.ts index dff2250930029..a03c250032cec 100644 --- a/extensions/simple-icons/src/types.ts +++ b/extensions/simple-icons/src/types.ts @@ -18,6 +18,7 @@ export type Aliases = { }; export type IconData = { + code: number; title: string; hex: string; source: string; diff --git a/extensions/simple-icons/src/utils.ts b/extensions/simple-icons/src/utils.ts index 6096721c95387..764025b2f085f 100644 --- a/extensions/simple-icons/src/utils.ts +++ b/extensions/simple-icons/src/utils.ts @@ -25,9 +25,12 @@ import { JsDelivrNpmResponse, IconData, LaunchContext } from "./types.js"; const cache = new Cache(); +export const fontUnicodeStart = 0xea01; + export const { defaultDetailAction = "OpenWith", defaultLoadSvgAction = "WithBrandColor", + displaySimpleIconsFontFeatures, enableAiSearch, } = getPreferenceValues(); @@ -88,16 +91,11 @@ export const cacheAssetPack = async (version: string) => { export const loadCachedJson = async (version: string) => { const [major] = version.split("."); const isNewFormat = Number(major) >= 14; - const jsonPath = join( - environment.assetsPath, - "pack", - `simple-icons-${version}`, - isNewFormat ? "data" : "_data", - "simple-icons.json", - ); + const jsonPath = join(environment.assetsPath, "pack", `simple-icons-${version}`, "_data", "simple-icons.json"); const jsonFile = await readFile(jsonPath, "utf8"); const json = JSON.parse(jsonFile); - return isNewFormat ? (json as IconData[]) : (json.icons as IconData[]); + const icons = isNewFormat ? (json as IconData[]) : (json.icons as IconData[]); + return icons.map((icon, i) => ({ ...icon, code: fontUnicodeStart + i })); }; export const loadCachedVersion = () => { From fe3305d2001573e89cefacdb62f86f3fda5c320e Mon Sep 17 00:00:00 2001 From: Nirmit Pandya Date: Wed, 1 Jan 2025 12:01:54 +0530 Subject: [PATCH 3/6] fix: Add placeholder --- extensions/twenty/src/components/FieldComponent.tsx | 5 +---- extensions/twenty/src/components/MultiSelect.tsx | 4 +++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/extensions/twenty/src/components/FieldComponent.tsx b/extensions/twenty/src/components/FieldComponent.tsx index a44dea9bb4eed..af8f3d4c287e4 100644 --- a/extensions/twenty/src/components/FieldComponent.tsx +++ b/extensions/twenty/src/components/FieldComponent.tsx @@ -27,11 +27,8 @@ export default function FieldComponent({ values }: FieldComponentProps) { return ; } case "MULTI_SELECT": { - return ; + return ; } - // case "MULTI_SELECT": { - // return ; - // } default: return <>; } diff --git a/extensions/twenty/src/components/MultiSelect.tsx b/extensions/twenty/src/components/MultiSelect.tsx index c57fba3d31956..2e6f7461b95ed 100644 --- a/extensions/twenty/src/components/MultiSelect.tsx +++ b/extensions/twenty/src/components/MultiSelect.tsx @@ -5,12 +5,13 @@ import { optionIcons } from "../enum/icons"; type MultiSelectProps = { field: DataModelField; + placeholder?: string }; // Use forwardRef for consistency and ref handling const MultiSelect = forwardRef>( ({ values, ...rest }, ref) => { - const { field } = values; + const { field, placeholder } = values; const { options } = field; const defaultValue = Array.isArray(field.defaultValue) @@ -24,6 +25,7 @@ const MultiSelect = forwardRef} From 27473626927550d37555f17635868ad76a915af3 Mon Sep 17 00:00:00 2001 From: Nirmit Pandya Date: Wed, 1 Jan 2025 12:08:51 +0530 Subject: [PATCH 4/6] fix: fix linting issue --- extensions/twenty/src/components/MultiSelect.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/twenty/src/components/MultiSelect.tsx b/extensions/twenty/src/components/MultiSelect.tsx index 2e6f7461b95ed..400898942d911 100644 --- a/extensions/twenty/src/components/MultiSelect.tsx +++ b/extensions/twenty/src/components/MultiSelect.tsx @@ -5,7 +5,7 @@ import { optionIcons } from "../enum/icons"; type MultiSelectProps = { field: DataModelField; - placeholder?: string + placeholder?: string; }; // Use forwardRef for consistency and ref handling From 6311c5166229fd1593a6076f04d2e218ff69bcf9 Mon Sep 17 00:00:00 2001 From: Nirmit Pandya Date: Wed, 1 Jan 2025 19:21:26 +0530 Subject: [PATCH 5/6] feat: Replace Select with Enter --- extensions/twenty/src/components/FieldComponent.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/twenty/src/components/FieldComponent.tsx b/extensions/twenty/src/components/FieldComponent.tsx index af8f3d4c287e4..6e15f23a6abc8 100644 --- a/extensions/twenty/src/components/FieldComponent.tsx +++ b/extensions/twenty/src/components/FieldComponent.tsx @@ -27,7 +27,7 @@ export default function FieldComponent({ values }: FieldComponentProps) { return ; } case "MULTI_SELECT": { - return ; + return ; } default: return <>; From 2707c4e8bfcc4ef34c26e21e8c8b0c4019df7485 Mon Sep 17 00:00:00 2001 From: raycastbot Date: Thu, 9 Jan 2025 06:16:34 +0000 Subject: [PATCH 6/6] Update CHANGELOG.md and optimise images --- extensions/twenty/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/twenty/CHANGELOG.md b/extensions/twenty/CHANGELOG.md index bfc7d61221ec6..0af6bee4dbed7 100644 --- a/extensions/twenty/CHANGELOG.md +++ b/extensions/twenty/CHANGELOG.md @@ -1,6 +1,6 @@ # Twenty Changelog -## [Enhancements] - {PR_MERGE_DATE} +## [Enhancements] - 2025-01-09 - Added support for multi-select field type