Skip to content
Draft
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
5 changes: 5 additions & 0 deletions .changeset/two-gifts-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@tokens-studio/figma-plugin": patch
---

Display project name instead of ID in Tokens Studio sync dropdown
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const StorageItem = ({ item, onEdit, onMigrate }: Props) => {
const storageType = useSelector(storageTypeSelector);
const { provider, id, name } = item;
const branch = isGitProvider(item) ? item.branch : null;
const projectName = provider === StorageProviderType.TOKENS_STUDIO && 'projectName' in item ? item.projectName : null;
const { restoreStoredProvider, deleteProvider } = useRemoteTokens();
const { confirm } = useConfirm();
const { setStorageType } = useStorage();
Expand Down Expand Up @@ -119,7 +120,7 @@ const StorageItem = ({ item, onEdit, onMigrate }: Props) => {
maxWidth: '100%',
}}
>
{id}
{projectName || id}
{' '}
{branch && ` (${branch})`}
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export default function TokensStudioForm({
secret: zod.string(),
internalId: zod.string().optional(),
orgId: zod.string(),
projectName: zod.string().optional(),
baseUrl: zod.string().optional(),
});
const validationResult = zodSchema.safeParse(values);
Expand Down Expand Up @@ -183,9 +184,13 @@ export default function TokensStudioForm({

const onProjectChange = React.useCallback(
(value: string) => {
const selectedProjectData = projectOptions.find((project) => project.value === value);
onChange({ target: { name: 'id', value } });
if (selectedProjectData) {
onChange({ target: { name: 'projectName', value: selectedProjectData.label } });
}
},
[onChange],
[onChange, projectOptions],
);

const handleBaseUrlBlur = React.useCallback(
Expand Down
1 change: 1 addition & 0 deletions packages/tokens-studio-for-figma/src/types/StorageType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ StorageProviderType.TOKENS_STUDIO,
name: string; // this is only for reference
orgId: string; // this is the organization id
id: string; // this is the project id
projectName?: string; // this is the project name for display purposes
baseUrl?: string; // this is the base URL for the Studio instance (optional for backward compatibility)
}
>;
Expand Down