Skip to content

Commit

Permalink
chore(style): apply prettier diff
Browse files Browse the repository at this point in the history
  • Loading branch information
masonmcelvain committed Oct 2, 2023
1 parent d381e5e commit 91b3d48
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/components/ActionBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default function ActionBar({
aria-label="Toggle color mode"
icon={useColorModeValue(
<Moon size={24} />,
<Sun size={24} />
<Sun size={24} />,
)}
onClick={onColorModeClick}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function Card({ linkData, isInEditMode, onClick }: CardProps) {
isDragEventInProgress: !!monitor.getItem(),
}),
}),
[id]
[id],
);

const conditionalButtonProps = isDragEventInProgress
Expand Down
14 changes: 7 additions & 7 deletions src/components/Cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ export default function Cell({
() =>
(!isEmpty &&
links.find(
(link) => link && getStorageKeyForLink(link) === linkKeys[index]
(link) => link && getStorageKeyForLink(link) === linkKeys[index],
)) ||
null,
[isEmpty, index, links, linkKeys]
[isEmpty, index, links, linkKeys],
);

const onClick = React.useCallback(
Expand All @@ -53,7 +53,7 @@ export default function Cell({
navigateCurrentTab(link.url);
}
},
[link?.url]
[link?.url],
);
const onKeyDown = React.useCallback(
(event: KeyboardEvent) => {
Expand All @@ -67,7 +67,7 @@ export default function Cell({
}
}
},
[index, isEmpty, isInEditMode, onClick, openUpdateLinkModal]
[index, isEmpty, isInEditMode, onClick, openUpdateLinkModal],
);
React.useEffect(() => {
document.addEventListener("keydown", onKeyDown);
Expand All @@ -84,7 +84,7 @@ export default function Cell({
onClick={onClick}
/>
),
[isInEditMode, link, onClick]
[isInEditMode, link, onClick],
);

const reorderLinks = useLinkStore((state) => state.reorderLinks);
Expand All @@ -104,7 +104,7 @@ export default function Cell({
isOver: monitor.isOver(),
}),
}),
[index, linkKeys]
[index, linkKeys],
);

React.useEffect(() => {
Expand All @@ -121,7 +121,7 @@ export default function Cell({
event.preventDefault();
deleteLink(index);
},
[deleteLink, index]
[deleteLink, index],
);

const isLastCellWithCard = index === links.length - 1;
Expand Down
12 changes: 6 additions & 6 deletions src/components/LinkEditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default function LinkEditModal({
onClose,
}: LinkEditModalProps) {
const [formValues, setFormValues] = React.useState<FormFields>(
getFormValuesForLink(link)
getFormValuesForLink(link),
);

const onKeyDown = React.useCallback<React.KeyboardEventHandler<HTMLElement>>(
Expand All @@ -64,7 +64,7 @@ export default function LinkEditModal({
onClose();
}
},
[isOpen, onClose]
[isOpen, onClose],
);

const populateFormWithTab = React.useCallback(async () => {
Expand Down Expand Up @@ -96,7 +96,7 @@ export default function LinkEditModal({
const nameError = name ? "" : "Please enter a name for the link";
setFormValues({ ...formValues, name, nameError });
},
[formValues, setFormValues]
[formValues, setFormValues],
);

const handleLinkUrlChange = React.useCallback<
Expand All @@ -108,7 +108,7 @@ export default function LinkEditModal({
const urlError = url ? "" : "Please enter a URL for the link";
setFormValues({ ...formValues, url, urlError });
},
[formValues, setFormValues]
[formValues, setFormValues],
);

const handleImageUrlChange = React.useCallback<
Expand All @@ -132,7 +132,7 @@ export default function LinkEditModal({
imageUrlError,
});
},
[formValues, setFormValues]
[formValues, setFormValues],
);

const addLink = useLinkStore((state) => state.addLink);
Expand All @@ -153,7 +153,7 @@ export default function LinkEditModal({
: addLink(payload);
onClose();
},
[addLink, formValues, link, onClose, updateLink]
[addLink, formValues, link, onClose, updateLink],
);

return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function Page() {
onLinkEditModalOpen();
}
},
[onLinkEditModalOpen, toggleEditMode]
[onLinkEditModalOpen, toggleEditMode],
);
React.useEffect(() => {
document.addEventListener("keydown", onKeyDown);
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useInitializeState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function useInitializeState() {

if (nextLinkId && linkKeys?.length) {
const storedLinks = parseStoredLinks(
await browser.storage.local.get(linkKeys)
await browser.storage.local.get(linkKeys),
);
const links =
(storedLinks && linkKeys.map((key) => storedLinks[key])) ?? [];
Expand Down
4 changes: 2 additions & 2 deletions src/lib/links/delete-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { LinkState } from "@models/link-state";

export function deleteLink(
prevState: LinkState,
linkKeyIndex: number
linkKeyIndex: number,
): LinkState {
const newLinkKeys = [...prevState.linkKeys];
const [deletedLinkKey] = newLinkKeys.splice(linkKeyIndex, 1);

const newLinks = prevState.links.filter(
(link) => deletedLinkKey !== getStorageKeyForLink(link)
(link) => deletedLinkKey !== getStorageKeyForLink(link),
);

setStoredLinksAndKeys(newLinks, newLinkKeys);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/links/reorder-links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ export type ReorderLinksData = {
*/
export function reorderLinks(
prevState: LinkState,
data: ReorderLinksData
data: ReorderLinksData,
): LinkState {
const { sourceId } = data;
let { newLinkKeyIndex } = data;
const newLinkKeys = [...prevState.linkKeys];

const oldLinkKeyIndex = newLinkKeys.findIndex(
(key) => getLinkIdForStorageKey(key) === sourceId
(key) => getLinkIdForStorageKey(key) === sourceId,
);

// If dropped in an empty cell, put the card at the end of the array
Expand Down
2 changes: 1 addition & 1 deletion src/lib/links/update-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export type UpdateLinkData = {

export function updateLink(
prevState: LinkState,
data: UpdateLinkData
data: UpdateLinkData,
): LinkState {
const { id, name, url, imageUrl } = data;

Expand Down
2 changes: 1 addition & 1 deletion src/lib/webextension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function setStoredColorMode(colorMode: ColorMode): void {

export function setStoredLinksAndKeys(
links: LinkData[],
linkKeys: string[]
linkKeys: string[],
): void {
setStoredLinkKeys(linkKeys);
setStoredLinks(links);
Expand Down
2 changes: 1 addition & 1 deletion src/public/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ createRoot(domNode).render(
<ChakraProvider theme={theme}>
<App />
</ChakraProvider>
</div>
</div>,
);
4 changes: 2 additions & 2 deletions tests/shortcuts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ test("can escape new link modal", async ({ page }) => {
await page.keyboard.down("n");
await page.keyboard.down("Escape");
await expect(
page.getByRole("button", { name: "Create new link" })
page.getByRole("button", { name: "Create new link" }),
).toBeVisible();
});

test("can escape edit link modal", async ({ page }) => {
await page.keyboard.down("e");
await page.keyboard.down("Escape");
await expect(
page.getByRole("button", { name: "Create new link" })
page.getByRole("button", { name: "Create new link" }),
).toBeVisible();
});
2 changes: 1 addition & 1 deletion tests/smoke.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { test, expect } from "@fixtures/extension";

test("new link button is visible", async ({ page }) => {
await expect(
page.getByRole("button", { name: "Create new link" })
page.getByRole("button", { name: "Create new link" }),
).toBeVisible();
});

0 comments on commit 91b3d48

Please sign in to comment.