Skip to content

Commit

Permalink
Version Property Placement (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansrofe authored Apr 16, 2024
1 parent 170a149 commit 75e875d
Showing 1 changed file with 11 additions and 19 deletions.
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

0 comments on commit 75e875d

Please sign in to comment.