Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version Property Placement #80

Merged
merged 2 commits into from
Apr 16, 2024
Merged
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
30 changes: 11 additions & 19 deletions widget-src/Widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import { Footer } from './components/Footer';
import { WidgetContainer } from './components/WidgetContainer';
import { ChangeLogEmpty } from './components/ChangeLogEmpty';
import { ChangeLogList } from './components/ChangeLogList';
import { ActionLockIcon } from './svgs/ActionLockIcon';
import { ActionUnlockIcon } from './svgs/ActionUnlockIcon';
import { COLOR } from './utilities/Styles';

const { currentUser, widget } = figma;
const { usePropertyMenu, useEffect, useSyncedMap, useSyncedState } = widget;
Expand All @@ -33,10 +30,10 @@ function Widget() {
changeIds.map((id: string) => {
if (id !== currentChangeId) {
const otherLog = changeLogs.get(id) as ChangeLog;
changeLogs.set(id, { ...otherLog, state: { ...otherLog.state, ...changes }})
changeLogs.set(id, { ...otherLog, state: { ...otherLog.state, ...changes } });
}
})
}
});
};

const addChange = (changeToAdd: string) => {
changeLogs.set(changeToAdd, {
Expand All @@ -55,12 +52,12 @@ function Widget() {
change: '',
type: 'none',
createdDate: Date.now(),
linkFormError: { label: false, url: false }
}
linkFormError: { label: false, url: false },
},
},
});
setChangeIds([changeToAdd, ...changeIds]);
updateOtherStates(changeToAdd, { editing: false })
updateOtherStates(changeToAdd, { editing: false });
setUpdatedDate(Date.now());
};
const deleteChange = (changeToDelete: string) => {
Expand All @@ -87,7 +84,10 @@ function Widget() {
propertyName: 'status',
},
{
itemType: 'separator',
itemType: 'toggle',
tooltip: 'Version',
propertyName: 'version',
isToggled: showVersion,
},
{
itemType: 'toggle',
Expand All @@ -101,12 +101,6 @@ function Widget() {
propertyName: 'description',
isToggled: showDescription,
},
{
itemType: 'toggle',
tooltip: 'Version',
propertyName: 'version',
isToggled: showVersion,
},
{
itemType: 'toggle',
tooltip: 'Log Types',
Expand Down Expand Up @@ -188,9 +182,7 @@ function Widget() {
isLocked={isLocked}
/>
{changeIds.length === 0 ? (
<ChangeLogEmpty
isLocked={isLocked}
/>
<ChangeLogEmpty isLocked={isLocked} />
) : (
<ChangeLogList
changeLogs={changeLogs}
Expand Down
Loading