Skip to content

Commit

Permalink
move group edit icon to groups container
Browse files Browse the repository at this point in the history
  • Loading branch information
longnghia committed Aug 25, 2024
1 parent a670de9 commit ccee5c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
11 changes: 2 additions & 9 deletions src/pages/popup/GroupView.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { isDev } from '@src/utils/env';
import { createTab, createTabs } from '@src/utils/tabs';
import { createTabs } from '@src/utils/tabs';
import { useState } from 'react';
import {
FaCaretDown, FaCaretUp, FaEdit,
FaCaretDown, FaCaretUp,
FaTrash,
} from 'react-icons/fa';
import GroupEdit from './GroupEdit';
Expand All @@ -29,10 +29,6 @@ export default function GroupView({
const onCollapse = () => {
setExpanded(false);
};
const openEditPage = () => {
createTab(chrome.runtime.getURL('groups/index.html'), true);
};

const updateGroup = (data: string[]) => {
setUrls(data);
onUpdate(data);
Expand Down Expand Up @@ -69,9 +65,6 @@ export default function GroupView({
<FaCaretDown className="hover:cursor-pointer" onClick={onExpand} />
)}
<div className="flex-1" />
{!isEditMode ? (
<FaEdit onClick={openEditPage} />
) : null}
{onRemove ? (
<FaTrash
className="text-red-500 hover:cursor-pointer"
Expand Down
10 changes: 9 additions & 1 deletion src/pages/popup/PopupGroups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import emptyIcon from '@assets/img/empty.svg';
import loadingIcon from '@assets/img/loading.svg';
import { Groups } from '@src/types';
import { getValue, setValue } from '@src/utils/storage';
import { createTab } from '@src/utils/tabs';
import toast from '@src/utils/toast';
import {
useCallback, useEffect, useState,
} from 'react';
import { FaPlusCircle } from 'react-icons/fa';
import { FaEdit, FaPlusCircle } from 'react-icons/fa';
import Modal from 'react-modal';
import GroupView from './GroupView';
import useError from './useError';
Expand Down Expand Up @@ -65,6 +66,10 @@ export default function PopupGroups({ isEditMode }:{isEditMode: boolean}): JSX.E
}
};

const openEditPage = () => {
createTab(chrome.runtime.getURL('groups/index.html'), true);
};

const closeModal = () => {
setSelectGroup(null);
};
Expand Down Expand Up @@ -158,6 +163,9 @@ export default function PopupGroups({ isEditMode }:{isEditMode: boolean}): JSX.E
autoFocus
/>
<FaPlusCircle onClick={() => { setNewGroup('New group'); }} />
{!isEditMode ? (
<FaEdit onClick={openEditPage} />
) : null}
</div>
{renderNewGroup()}
<div className="flex flex-col mt-4">
Expand Down

0 comments on commit ccee5c4

Please sign in to comment.