From 765add71a97a9e53f3360a5d9f264c2b556578d2 Mon Sep 17 00:00:00 2001 From: Chris Walsh Date: Sun, 24 Jul 2022 23:07:56 -0700 Subject: [PATCH] Restore table component and website settings page --- components/common/Table.js | 39 ++-------------- components/settings/WebsiteSettings.js | 44 +++---------------- .../settings/WebsiteSettings.module.css | 6 --- 3 files changed, 9 insertions(+), 80 deletions(-) diff --git a/components/common/Table.js b/components/common/Table.js index acd4f160..77a07712 100644 --- a/components/common/Table.js +++ b/components/common/Table.js @@ -1,4 +1,3 @@ -import { DragDropContext, Draggable, Droppable } from 'react-beautiful-dnd'; import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; @@ -14,9 +13,6 @@ function Table({ rowKey, showHeader = true, children, - isDraggable = false, - dragId, - onDragEnd, }) { if (empty && rows.length === 0) { return empty; @@ -40,37 +36,10 @@ function Table({
{rows.length === 0 && } {!children && - (isDraggable ? ( - - - {provided => ( -
- {rows.map((row, index) => { - const id = rowKey ? rowKey(row) : index; - return ( - - {provided => ( -
- -
- )} -
- ); - })} -
- )} -
-
- ) : ( - rows.map((row, index) => { - const id = rowKey ? rowKey(row) : index; - return ; - }) - ))} + rows.map((row, index) => { + const id = rowKey ? rowKey(row) : index; + return ; + })} {children}
diff --git a/components/settings/WebsiteSettings.js b/components/settings/WebsiteSettings.js index 46f953d3..f5cd31e6 100644 --- a/components/settings/WebsiteSettings.js +++ b/components/settings/WebsiteSettings.js @@ -25,7 +25,7 @@ import LinkIcon from 'assets/link.svg'; import useFetch from 'hooks/useFetch'; import useUser from 'hooks/useUser'; import { orderByWebsiteMap } from 'lib/format'; -import useStore, { setDashboard } from 'store/app'; +import useStore from 'store/app'; import styles from './WebsiteSettings.module.css'; const selector = state => state.dashboard; @@ -167,28 +167,6 @@ export default function WebsiteSettings() { setShowUrl(null); } - function handleWebsiteDrag({ destination, source }) { - if (!destination || destination.index === source.index) return; - - const orderedWebsites = [...ordered]; - const [removed] = orderedWebsites.splice(source.index, 1); - orderedWebsites.splice(destination.index, 0, removed); - - setDashboard({ - ...store, - websiteOrdering: orderedWebsites - .map((i, k) => ({ [i.website_uuid]: k })) - .reduce((a, b) => ({ ...a, ...b })), - }); - } - - function resetWebsiteOrder() { - setDashboard({ - ...store, - websiteOrdering: {}, - }); - } - if (!data) { return null; } @@ -214,23 +192,11 @@ export default function WebsiteSettings() {
-
- - -
+ - +
{editWebsite && ( }> diff --git a/components/settings/WebsiteSettings.module.css b/components/settings/WebsiteSettings.module.css index dbb04eb8..a69d4101 100644 --- a/components/settings/WebsiteSettings.module.css +++ b/components/settings/WebsiteSettings.module.css @@ -11,9 +11,3 @@ .detailLink { width: 100%; } - -.headerButtons { - display: flex; - justify-content: flex-end; - gap: 10px; -}