From 0ebdbc0f9138441acbf2865857b84d3fa5f23dbf Mon Sep 17 00:00:00 2001 From: Chewbacca Date: Wed, 16 Nov 2022 14:35:20 -0500 Subject: [PATCH 1/5] Remove 'setting-toggle.scss' --- app/soapbox/features/chats/components/audio-toggle.tsx | 7 +------ app/styles/application.scss | 1 - app/styles/components/setting-toggle.scss | 3 --- 3 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 app/styles/components/setting-toggle.scss diff --git a/app/soapbox/features/chats/components/audio-toggle.tsx b/app/soapbox/features/chats/components/audio-toggle.tsx index 96ddf6211..3f3cce397 100644 --- a/app/soapbox/features/chats/components/audio-toggle.tsx +++ b/app/soapbox/features/chats/components/audio-toggle.tsx @@ -11,11 +11,7 @@ const messages = defineMessages({ switchOff: { id: 'chats.audio_toggle_off', defaultMessage: 'Audio notification off' }, }); -interface IAudioToggle { - showLabel?: boolean -} - -const AudioToggle: React.FC = ({ showLabel }) => { +const AudioToggle: React.FC = () => { const dispatch = useDispatch(); const intl = useIntl(); @@ -37,7 +33,6 @@ const AudioToggle: React.FC = ({ showLabel }) => { onChange={handleToggleAudio} // onKeyDown={this.onKeyDown} /> - {showLabel && ()} ); diff --git a/app/styles/application.scss b/app/styles/application.scss index b7e109f5b..df2d96135 100644 --- a/app/styles/application.scss +++ b/app/styles/application.scss @@ -50,7 +50,6 @@ @import 'components/wtf-panel'; @import 'components/profile-media-panel'; @import 'components/profile-info-panel'; -@import 'components/setting-toggle'; @import 'components/spoiler-button'; @import 'components/video-player'; @import 'components/audio-player'; diff --git a/app/styles/components/setting-toggle.scss b/app/styles/components/setting-toggle.scss deleted file mode 100644 index 1acbcfffe..000000000 --- a/app/styles/components/setting-toggle.scss +++ /dev/null @@ -1,3 +0,0 @@ -.setting-toggle__label { - color: var(--gray-800); -} From 2c4d45d41852ef29eb51150001fefa739a62f4cf Mon Sep 17 00:00:00 2001 From: Chewbacca Date: Wed, 16 Nov 2022 14:35:34 -0500 Subject: [PATCH 2/5] Remove 'remote-timeline.scss' --- app/styles/application.scss | 1 - app/styles/components/remote-timeline.scss | 4 ---- 2 files changed, 5 deletions(-) delete mode 100644 app/styles/components/remote-timeline.scss diff --git a/app/styles/application.scss b/app/styles/application.scss index df2d96135..b36a2e1a8 100644 --- a/app/styles/application.scss +++ b/app/styles/application.scss @@ -59,7 +59,6 @@ @import 'components/admin'; @import 'components/backups'; @import 'components/crypto-donate'; -@import 'components/remote-timeline'; @import 'components/aliases'; @import 'components/icon'; @import 'components/radio-button'; diff --git a/app/styles/components/remote-timeline.scss b/app/styles/components/remote-timeline.scss deleted file mode 100644 index c59427a3f..000000000 --- a/app/styles/components/remote-timeline.scss +++ /dev/null @@ -1,4 +0,0 @@ -.federation-restriction { - display: flex; - padding: 15px 0; -} From e5ea7331dfeca49005ac49766d948fae51c39191 Mon Sep 17 00:00:00 2001 From: Chewbacca Date: Wed, 16 Nov 2022 15:04:15 -0500 Subject: [PATCH 3/5] Remove 'wtf-panel.scss' --- app/styles/application.scss | 1 - app/styles/components/sidebar-menu.scss | 5 -- app/styles/components/wtf-panel.scss | 73 ------------------------- 3 files changed, 79 deletions(-) delete mode 100644 app/styles/components/wtf-panel.scss diff --git a/app/styles/application.scss b/app/styles/application.scss index b36a2e1a8..e2a9f5aad 100644 --- a/app/styles/application.scss +++ b/app/styles/application.scss @@ -47,7 +47,6 @@ @import 'components/react-toggle'; @import 'components/still-image'; @import 'components/trends'; -@import 'components/wtf-panel'; @import 'components/profile-media-panel'; @import 'components/profile-info-panel'; @import 'components/spoiler-button'; diff --git a/app/styles/components/sidebar-menu.scss b/app/styles/components/sidebar-menu.scss index 9c015badb..9d3625863 100644 --- a/app/styles/components/sidebar-menu.scss +++ b/app/styles/components/sidebar-menu.scss @@ -16,8 +16,3 @@ transform: translateX(0); } } - -.sidebar-menu .wtf-panel { - box-shadow: none !important; - margin: 0; -} diff --git a/app/styles/components/wtf-panel.scss b/app/styles/components/wtf-panel.scss deleted file mode 100644 index 2d536e781..000000000 --- a/app/styles/components/wtf-panel.scss +++ /dev/null @@ -1,73 +0,0 @@ -.wtf-panel { - @include standard-panel; - display: flex; - width: 100%; - flex-direction: column; - height: auto; - box-sizing: border-box; - - @media screen and (max-width: 580px) { - border-radius: 0; - } - - &:first-child { - margin-top: 0; - } - - &:not(:last-of-type) { - margin-bottom: 10px; - } - - .wtf-panel-header { - display: flex; - align-items: center; - margin-bottom: 10px; - padding: 15px 15px 0; - - &__icon { - margin-right: 10px; - font-size: 20px; - - &.svg-icon { - width: 20px; - height: 20px; - } - } - - &__label { - flex: 1 1; - color: var(--primary-text-color); - font-size: 16px; - font-weight: bold; - line-height: 19px; - } - } - - &__content { - width: 100%; - padding-top: 8px; - } - - &__list { - padding: 0 5px; - } - - &__expand-btn { - @apply border-gray-300 dark:border-gray-600; - display: block; - width: 100%; - height: 100%; - max-height: 46px; - position: relative; - border-top: 1px solid; - transition: max-height 150ms ease; - overflow: hidden; - opacity: 1; - text-align: center; - line-height: 46px; - font-size: 14px; - cursor: pointer; - color: var(--primary-text-color); - text-decoration: none; - } -} From 5f67eb26ca37fcbe538db72a89d45af4f8f03d84 Mon Sep 17 00:00:00 2001 From: Chewbacca Date: Wed, 16 Nov 2022 15:10:57 -0500 Subject: [PATCH 4/5] Remove 'trends.scss' --- .../components/placeholder-hashtag.tsx | 8 +- app/styles/application.scss | 1 - app/styles/components/trends.scss | 78 ------------------- app/styles/placeholder.scss | 6 -- 4 files changed, 2 insertions(+), 91 deletions(-) delete mode 100644 app/styles/components/trends.scss diff --git a/app/soapbox/features/placeholder/components/placeholder-hashtag.tsx b/app/soapbox/features/placeholder/components/placeholder-hashtag.tsx index 28dceec72..8830b1e90 100644 --- a/app/soapbox/features/placeholder/components/placeholder-hashtag.tsx +++ b/app/soapbox/features/placeholder/components/placeholder-hashtag.tsx @@ -7,12 +7,8 @@ const PlaceholderHashtag: React.FC = () => { const length = randomIntFromInterval(15, 30); return ( -
-
-
- {generateText(length)} -
-
+
+

{generateText(length)}

); }; diff --git a/app/styles/application.scss b/app/styles/application.scss index e2a9f5aad..3b3bd527c 100644 --- a/app/styles/application.scss +++ b/app/styles/application.scss @@ -46,7 +46,6 @@ @import 'components/search'; @import 'components/react-toggle'; @import 'components/still-image'; -@import 'components/trends'; @import 'components/profile-media-panel'; @import 'components/profile-info-panel'; @import 'components/spoiler-button'; diff --git a/app/styles/components/trends.scss b/app/styles/components/trends.scss deleted file mode 100644 index 7984aa873..000000000 --- a/app/styles/components/trends.scss +++ /dev/null @@ -1,78 +0,0 @@ -.trends { - &__header { - color: var(--primary-text-color); - background: var(--brand-color--faint); - border-bottom: 1px solid var(--brand-color--med); - font-weight: 500; - padding: 15px; - font-size: 16px; - cursor: default; - - .fa { - display: inline-block; - margin-right: 5px; - } - } - - &__item { - display: flex; - align-items: center; - padding: 15px; - border-bottom: 1px solid var(--brand-color--med); - - &:last-child { - border-bottom: 0; - } - - &__name { - flex: 1 1 auto; - color: var(--primary-text-color); - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - font-size: 13px; - - strong { - font-weight: bold; - } - - a { - color: var(--primary-text-color--faint); - text-decoration: none; - font-size: 14px; - font-weight: 500; - display: block; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - - &:hover, - &:focus, - &:active { - span { - text-decoration: underline; - } - } - } - } - - &__current { - flex: 0 0 auto; - width: 100px; - font-size: 24px; - line-height: 36px; - font-weight: 500; - text-align: center; - color: var(--primary-text-color--faint); - } - - &__sparkline { - flex: 0 0 auto; - width: 50px; - - path { - stroke: var(--highlight-text-color) !important; - } - } - } -} diff --git a/app/styles/placeholder.scss b/app/styles/placeholder.scss index 72a69c155..709926650 100644 --- a/app/styles/placeholder.scss +++ b/app/styles/placeholder.scss @@ -1,4 +1,3 @@ -.placeholder-hashtag, .media-gallery--placeholder { position: relative; @@ -32,11 +31,6 @@ 100% { background-position-x: 0; } } -.placeholder-hashtag .trends__item__name { - color: var(--brand-color); - opacity: 0.1; -} - .chat-list-item--placeholder .chat__last-message { letter-spacing: -1px; color: var(--brand-color) !important; From 9b70a2487e269afa5be2a65225091a4bb2afb458 Mon Sep 17 00:00:00 2001 From: Chewbacca Date: Wed, 16 Nov 2022 16:38:32 -0500 Subject: [PATCH 5/5] Remove 'radio-button.scss', 'dirctory.scss' and move RadioButton to UI Components --- app/soapbox/components/radio-button.tsx | 28 --- app/soapbox/components/ui/index.ts | 1 + .../ui/radio-button/radio-button.tsx | 37 ++++ .../directory/components/account-card.tsx | 108 +++++++---- app/soapbox/features/directory/index.tsx | 60 ++++-- app/soapbox/reducers/user-lists.ts | 5 +- app/styles/application.scss | 2 - app/styles/components/directory.scss | 179 ------------------ app/styles/components/radio-button.scss | 38 ---- 9 files changed, 149 insertions(+), 309 deletions(-) delete mode 100644 app/soapbox/components/radio-button.tsx create mode 100644 app/soapbox/components/ui/radio-button/radio-button.tsx delete mode 100644 app/styles/components/directory.scss delete mode 100644 app/styles/components/radio-button.scss diff --git a/app/soapbox/components/radio-button.tsx b/app/soapbox/components/radio-button.tsx deleted file mode 100644 index 2d350b953..000000000 --- a/app/soapbox/components/radio-button.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import classNames from 'clsx'; -import React from 'react'; - -interface IRadioButton { - value: string, - checked?: boolean, - name: string, - onChange: React.ChangeEventHandler, - label: React.ReactNode, -} - -const RadioButton: React.FC = ({ name, value, checked, onChange, label }) => ( - -); - -export default RadioButton; diff --git a/app/soapbox/components/ui/index.ts b/app/soapbox/components/ui/index.ts index c7d4c7e4f..90f5933ed 100644 --- a/app/soapbox/components/ui/index.ts +++ b/app/soapbox/components/ui/index.ts @@ -31,6 +31,7 @@ export { export { default as Modal } from './modal/modal'; export { default as PhoneInput } from './phone-input/phone-input'; export { default as ProgressBar } from './progress-bar/progress-bar'; +export { default as RadioButton } from './radio-button/radio-button'; export { default as Select } from './select/select'; export { default as Spinner } from './spinner/spinner'; export { default as Stack } from './stack/stack'; diff --git a/app/soapbox/components/ui/radio-button/radio-button.tsx b/app/soapbox/components/ui/radio-button/radio-button.tsx new file mode 100644 index 000000000..322cbd7e7 --- /dev/null +++ b/app/soapbox/components/ui/radio-button/radio-button.tsx @@ -0,0 +1,37 @@ +import React, { useMemo } from 'react'; +import { v4 as uuidv4 } from 'uuid'; + +interface IRadioButton { + value: string + checked?: boolean + name: string + onChange: React.ChangeEventHandler + label: React.ReactNode +} + +/** + * A group for radio input with label. + */ +const RadioButton: React.FC = ({ name, value, checked, onChange, label }) => { + const formFieldId: string = useMemo(() => `radio-${uuidv4()}`, []); + + return ( +
+ + + +
+ ); +}; + +export default RadioButton; diff --git a/app/soapbox/features/directory/components/account-card.tsx b/app/soapbox/features/directory/components/account-card.tsx index f405c95fa..6c6d0a697 100644 --- a/app/soapbox/features/directory/components/account-card.tsx +++ b/app/soapbox/features/directory/components/account-card.tsx @@ -1,13 +1,12 @@ import classNames from 'clsx'; import React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; import { getSettings } from 'soapbox/actions/settings'; -import Avatar from 'soapbox/components/avatar'; -import DisplayName from 'soapbox/components/display-name'; +import Badge from 'soapbox/components/badge'; import RelativeTimestamp from 'soapbox/components/relative-timestamp'; -import { Text } from 'soapbox/components/ui'; +import { Stack, Text } from 'soapbox/components/ui'; +import AccountContainer from 'soapbox/containers/account-container'; import ActionButton from 'soapbox/features/ui/components/action-button'; import { useAppSelector } from 'soapbox/hooks'; import { makeGetAccount } from 'soapbox/selectors'; @@ -29,51 +28,76 @@ const AccountCard: React.FC = ({ id }) => { const followedBy = me !== account.id && account.relationship?.followed_by; return ( -
- {followedBy && -
- - - -
} -
- -
-
- -
+
+
+ {followedBy && ( +
+ } + /> +
+ )} -
- - - - -
+
+ +
-
-

') && 'empty')} - dangerouslySetInnerHTML={{ __html: account.note_emojified }} +
-
-
- + + + + + + +
+ + {shortNumberFormat(account.statuses_count)} - -
-
- + + + + + + + + + {shortNumberFormat(account.followers_count)} - - -
-
- {account.last_status_at === null - ? - : } -
+
+ + + + + + + + + {account.last_status_at === null ? ( + + ) : ( + + )} + + + + + +
); diff --git a/app/soapbox/features/directory/index.tsx b/app/soapbox/features/directory/index.tsx index 218df836f..1266ed0ab 100644 --- a/app/soapbox/features/directory/index.tsx +++ b/app/soapbox/features/directory/index.tsx @@ -6,8 +6,7 @@ import { useLocation } from 'react-router-dom'; import { fetchDirectory, expandDirectory } from 'soapbox/actions/directory'; import LoadMore from 'soapbox/components/load-more'; -import RadioButton from 'soapbox/components/radio-button'; -import Column from 'soapbox/features/ui/components/column'; +import { Column, RadioButton, Stack, Text } from 'soapbox/components/ui'; import { useAppSelector } from 'soapbox/hooks'; import { getFeatures } from 'soapbox/utils/features'; @@ -52,26 +51,49 @@ const Directory = () => { }; return ( - -
-
- - + + +
+
+ Display filter +
+ Display filter +
+ + +
+
+
+ + {features.federating && ( +
+ Fediverse filter +
+ Fediverse filter +
+ + +
+
+
+ )}
- {features.federating && ( -
- - -
- )} -
+
+ {accountIds.map((accountId) => ( + ), + )} +
-
- {accountIds.map((accountId) => )} -
- - + + ); }; diff --git a/app/soapbox/reducers/user-lists.ts b/app/soapbox/reducers/user-lists.ts index 721af9b73..7f5ce6716 100644 --- a/app/soapbox/reducers/user-lists.ts +++ b/app/soapbox/reducers/user-lists.ts @@ -97,7 +97,10 @@ const normalizeList = (state: State, path: NestedListPath | ListPath, accounts: const appendToList = (state: State, path: NestedListPath | ListPath, accounts: APIEntity[], next: string | null) => { return state.updateIn(path, map => { - return (map as List).set('next', next).update('items', list => (list as Items).concat(accounts.map(item => item.id))); + return (map as List) + .set('next', next) + .set('isLoading', false) + .update('items', list => (list as Items).concat(accounts.map(item => item.id))); }); }; diff --git a/app/styles/application.scss b/app/styles/application.scss index 3b3bd527c..ed74ec3aa 100644 --- a/app/styles/application.scss +++ b/app/styles/application.scss @@ -59,8 +59,6 @@ @import 'components/crypto-donate'; @import 'components/aliases'; @import 'components/icon'; -@import 'components/radio-button'; -@import 'components/directory'; @tailwind base; @tailwind components; diff --git a/app/styles/components/directory.scss b/app/styles/components/directory.scss deleted file mode 100644 index 7dc8e48cd..000000000 --- a/app/styles/components/directory.scss +++ /dev/null @@ -1,179 +0,0 @@ -.directory { - &__filter-form { - display: flex; - gap: 30px; - background: var(--foreground-color); - - &__column { - padding-bottom: 10px; - } - - .radio-button { - display: block; - } - } - - &__list { - display: grid; - grid-gap: 10px; - grid-template-columns: minmax(0, 50%) minmax(0, 50%); - width: 100%; - transition: opacity 100ms ease-in; - box-sizing: border-box; - - &.loading { - opacity: 0.7; - } - - @media screen and (max-width: 630px) { - grid-template-columns: minmax(0, 100%); - } - } - - &__card { - @apply rounded-lg bg-gray-100 dark:bg-primary-800; - box-sizing: border-box; - margin-bottom: 0; - box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.1); - overflow: hidden; - position: relative; - - &__info { - z-index: 1; - position: absolute; - top: 10px; - left: 10px; - } - - &__action-button { - z-index: 1; - position: absolute; - top: 78px; - right: 12px; - } - - &__img { - @apply bg-primary-200 dark:bg-gray-600; - height: 125px; - position: relative; - - img { - display: block; - width: 100%; - height: 100%; - margin: 0; - object-fit: cover; - } - } - - &__bar { - @apply bg-primary-200 dark:bg-primary-700; - display: flex; - align-items: center; - padding: 10px; - - &__name { - flex: 1 1 auto; - display: flex; - align-items: center; - text-decoration: none; - overflow: hidden; - } - - .account__avatar { - flex: 0 0 auto; - width: 48px; - min-width: 48px; - height: 48px; - padding-top: 2px; - - img { - width: 100%; - height: 100%; - display: block; - margin: 0; - border-radius: 4px; - background: var(--brand-color--faint); - object-fit: cover; - } - } - - .display-name { - margin-left: 15px; - text-align: left; - - strong { - @apply text-black dark:text-white; - font-size: 15px; - font-weight: 500; - overflow: hidden; - text-overflow: ellipsis; - } - - span:not(.verified-icon) { - @apply text-gray-500 dark:text-gray-400; - display: block; - font-size: 14px; - font-weight: 400; - overflow: hidden; - text-overflow: ellipsis; - } - - .verified-icon div, - .verified-icon svg { - @apply inline; - } - } - } - - &__extra { - background: var(--foreground-color); - display: flex; - align-items: center; - justify-content: center; - - .accounts-table__count { - padding: 15px 0; - text-align: center; - font-size: 15px; - font-weight: 500; - width: 33.33%; - flex: 0 0 auto; - - small { - display: block; - color: var(--primary-text-color--faint); - font-weight: 400; - font-size: 14px; - } - } - - .account__header__content { - @apply border-b border-solid border-gray-200 dark:border-primary-500; - box-sizing: border-box; - padding: 15px 10px; - width: 100%; - min-height: 50px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - - &.empty { - border-color: transparent; - } - - p { - display: none; - - &:first-child { - display: inline; - } - } - - br { - display: none; - } - } - } - } -} diff --git a/app/styles/components/radio-button.scss b/app/styles/components/radio-button.scss deleted file mode 100644 index 77fb82846..000000000 --- a/app/styles/components/radio-button.scss +++ /dev/null @@ -1,38 +0,0 @@ -.radio-button { - @apply text-black dark:text-white; - font-size: 14px; - position: relative; - display: inline-block; - padding: 6px 0; - line-height: 18px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - cursor: pointer; - - input[type=radio], - input[type=checkbox] { - display: none; - } - - &__input { - @apply inline-block relative box-border border border-solid border-primary-600; - width: 18px; - height: 18px; - flex: 0 0 auto; - margin-right: 10px; - top: -1px; - border-radius: 50%; - vertical-align: middle; - - &.checked { - @apply bg-primary-600; - } - - &:active, - &:focus, - &:hover { - @apply border-4; - } - } -}