Update filter preview
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
1d4d9c2732
commit
d969c91c76
4 changed files with 38 additions and 38 deletions
|
@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
- Posts: Support posts filtering on recent Mastodon versions
|
||||
|
||||
### Changed
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ interface IEditFilter {
|
|||
|
||||
const messages = defineMessages({
|
||||
subheading_add_new: { id: 'column.filters.subheading_add_new', defaultMessage: 'Add New Filter' },
|
||||
subheading_edit: { id: 'column.filters.subheading_edit', defaultMessage: 'Edit Filter' },
|
||||
title: { id: 'column.filters.title', defaultMessage: 'Title' },
|
||||
keyword: { id: 'column.filters.keyword', defaultMessage: 'Keyword or phrase' },
|
||||
keywords: { id: 'column.filters.keywords', defaultMessage: 'Keywords or phrases' },
|
||||
|
@ -41,8 +40,6 @@ const messages = defineMessages({
|
|||
drop_hint: { id: 'column.filters.drop_hint', defaultMessage: 'Filtered posts will disappear irreversibly, even if filter is later removed' },
|
||||
hide_header: { id: 'column.filters.hide_header', defaultMessage: 'Hide completely' },
|
||||
hide_hint: { id: 'column.filters.hide_hint', defaultMessage: 'Completely hide the filtered content, instead of showing a warning' },
|
||||
whole_word_header: { id: 'column.filters.whole_word_header', defaultMessage: 'Whole word' },
|
||||
whole_word_hint: { id: 'column.filters.whole_word_hint', defaultMessage: 'When the keyword or phrase is alphanumeric only, it will only be applied if it matches the whole word' },
|
||||
add_new: { id: 'column.filters.add_new', defaultMessage: 'Add New Filter' },
|
||||
edit: { id: 'column.filters.edit', defaultMessage: 'Edit Filter' },
|
||||
create_error: { id: 'column.filters.create_error', defaultMessage: 'Error adding filter' },
|
||||
|
|
|
@ -3,34 +3,20 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|||
import { useHistory } from 'react-router-dom';
|
||||
|
||||
import { fetchFilters, deleteFilter } from 'soapbox/actions/filters';
|
||||
import RelativeTimestamp from 'soapbox/components/relative-timestamp';
|
||||
import ScrollableList from 'soapbox/components/scrollable-list';
|
||||
import { Button, CardTitle, Column, HStack, Stack, Text } from 'soapbox/components/ui';
|
||||
import { useAppDispatch, useAppSelector } from 'soapbox/hooks';
|
||||
import { Button, Column, HStack, Stack, Text } from 'soapbox/components/ui';
|
||||
import { useAppDispatch, useAppSelector, useFeatures } from 'soapbox/hooks';
|
||||
import toast from 'soapbox/toast';
|
||||
|
||||
const messages = defineMessages({
|
||||
heading: { id: 'column.filters', defaultMessage: 'Muted words' },
|
||||
subheading_add_new: { id: 'column.filters.subheading_add_new', defaultMessage: 'Add New Filter' },
|
||||
title: { id: 'column.filters.title', defaultMessage: 'Title' },
|
||||
keyword: { id: 'column.filters.keyword', defaultMessage: 'Keyword or phrase' },
|
||||
keywords: { id: 'column.filters.keywords', defaultMessage: 'Keywords or phrases' },
|
||||
expires: { id: 'column.filters.expires', defaultMessage: 'Expire after' },
|
||||
expires_hint: { id: 'column.filters.expires_hint', defaultMessage: 'Expiration dates are not currently supported' },
|
||||
home_timeline: { id: 'column.filters.home_timeline', defaultMessage: 'Home timeline' },
|
||||
public_timeline: { id: 'column.filters.public_timeline', defaultMessage: 'Public timeline' },
|
||||
notifications: { id: 'column.filters.notifications', defaultMessage: 'Notifications' },
|
||||
conversations: { id: 'column.filters.conversations', defaultMessage: 'Conversations' },
|
||||
accounts: { id: 'column.filters.accounts', defaultMessage: 'Accounts' },
|
||||
drop_header: { id: 'column.filters.drop_header', defaultMessage: 'Drop instead of hide' },
|
||||
drop_hint: { id: 'column.filters.drop_hint', defaultMessage: 'Filtered posts will disappear irreversibly, even if filter is later removed' },
|
||||
hide_header: { id: 'column.filters.hide_header', defaultMessage: 'Hide completely' },
|
||||
hide_hint: { id: 'column.filters.hide_hint', defaultMessage: 'Completely hide the filtered content, instead of showing a warning' },
|
||||
whole_word_header: { id: 'column.filters.whole_word_header', defaultMessage: 'Whole word' },
|
||||
whole_word_hint: { id: 'column.filters.whole_word_hint', defaultMessage: 'When the keyword or phrase is alphanumeric only, it will only be applied if it matches the whole word' },
|
||||
add_new: { id: 'column.filters.add_new', defaultMessage: 'Add New Filter' },
|
||||
create_error: { id: 'column.filters.create_error', defaultMessage: 'Error adding filter' },
|
||||
delete_error: { id: 'column.filters.delete_error', defaultMessage: 'Error deleting filter' },
|
||||
subheading_filters: { id: 'column.filters.subheading_filters', defaultMessage: 'Current Filters' },
|
||||
edit: { id: 'column.filters.edit', defaultMessage: 'Edit' },
|
||||
delete: { id: 'column.filters.delete', defaultMessage: 'Delete' },
|
||||
});
|
||||
|
@ -47,6 +33,7 @@ const Filters = () => {
|
|||
const intl = useIntl();
|
||||
const dispatch = useAppDispatch();
|
||||
const history = useHistory();
|
||||
const { filtersV2 } = useFeatures();
|
||||
|
||||
const filters = useAppSelector((state) => state.filters);
|
||||
|
||||
|
@ -68,8 +55,7 @@ const Filters = () => {
|
|||
|
||||
return (
|
||||
<Column className='filter-settings-panel' label={intl.formatMessage(messages.heading)}>
|
||||
<HStack className='mb-4' space={2} justifyContent='between'>
|
||||
<CardTitle title={intl.formatMessage(messages.subheading_filters)} />
|
||||
<HStack className='mb-4' space={2} justifyContent='end'>
|
||||
<Button
|
||||
to='/filters/new'
|
||||
theme='primary'
|
||||
|
@ -98,17 +84,23 @@ const Filters = () => {
|
|||
{' '}
|
||||
<Text theme='muted' tag='span'>{filter.context.map(context => contexts[context] ? intl.formatMessage(contexts[context]) : context).join(', ')}</Text>
|
||||
</Text>
|
||||
<HStack space={4}>
|
||||
{/* <Text weight='medium'>
|
||||
{filter.irreversible ?
|
||||
<FormattedMessage id='filters.filters_list_drop' defaultMessage='Drop' /> :
|
||||
<FormattedMessage id='filters.filters_list_hide' defaultMessage='Hide' />}
|
||||
</Text>
|
||||
{filter.whole_word && (
|
||||
<Text weight='medium'>
|
||||
<FormattedMessage id='filters.filters_list_whole-word' defaultMessage='Whole word' />
|
||||
</Text>
|
||||
)} */}
|
||||
<HStack space={4} wrap>
|
||||
<Text weight='medium'>
|
||||
{filtersV2 ? (
|
||||
filter.filter_action === 'hide' ?
|
||||
<FormattedMessage id='filters.filters_list_hide_completely' defaultMessage='Hide content' /> :
|
||||
<FormattedMessage id='filters.filters_list_warn' defaultMessage='Display warning' />
|
||||
) : (filter.filter_action === 'hide' ?
|
||||
<FormattedMessage id='filters.filters_list_drop' defaultMessage='Drop' /> :
|
||||
<FormattedMessage id='filters.filters_list_hide' defaultMessage='Hide' />)}
|
||||
</Text>
|
||||
{filter.expires_at && (
|
||||
<Text weight='medium'>
|
||||
{new Date(filter.expires_at).getTime() <= Date.now()
|
||||
? <FormattedMessage id='filters.filters_list_expired' defaultMessage='Expired' />
|
||||
: <RelativeTimestamp timestamp={filter.expires_at} className='whitespace-nowrap' futureDate />}
|
||||
</Text>
|
||||
)}
|
||||
</HStack>
|
||||
</Stack>
|
||||
<HStack space={2} justifyContent='end'>
|
||||
|
|
|
@ -283,6 +283,13 @@
|
|||
"chats.main.blankslate_with_chats.subtitle": "Select from one of your open chats or create a new message.",
|
||||
"chats.main.blankslate_with_chats.title": "Select a chat",
|
||||
"chats.search_placeholder": "Start a chat with…",
|
||||
"colum.filters.expiration.1800": "30 minutes",
|
||||
"colum.filters.expiration.21600": "6 hours",
|
||||
"colum.filters.expiration.3600": "1 hour",
|
||||
"colum.filters.expiration.43200": "12 hours",
|
||||
"colum.filters.expiration.604800": "1 week",
|
||||
"colum.filters.expiration.86400": "1 day",
|
||||
"colum.filters.expiration.never": "Never",
|
||||
"column.admin.announcements": "Announcements",
|
||||
"column.admin.awaiting_approval": "Awaiting Approval",
|
||||
"column.admin.create_announcement": "Create announcement",
|
||||
|
@ -329,8 +336,8 @@
|
|||
"column.filters.delete_error": "Error deleting filter",
|
||||
"column.filters.drop_header": "Drop instead of hide",
|
||||
"column.filters.drop_hint": "Filtered posts will disappear irreversibly, even if filter is later removed",
|
||||
"column.filters.edit": "Edit",
|
||||
"column.filters.expires": "Expire after",
|
||||
"column.filters.expires_hint": "Expiration dates are not currently supported",
|
||||
"column.filters.hide_header": "Hide completely",
|
||||
"column.filters.hide_hint": "Completely hide the filtered content, instead of showing a warning",
|
||||
"column.filters.home_timeline": "Home timeline",
|
||||
|
@ -339,11 +346,8 @@
|
|||
"column.filters.notifications": "Notifications",
|
||||
"column.filters.public_timeline": "Public timeline",
|
||||
"column.filters.subheading_add_new": "Add New Filter",
|
||||
"column.filters.subheading_filters": "Current Filters",
|
||||
"column.filters.title": "Title",
|
||||
"column.filters.whole_word": "Whole word",
|
||||
"column.filters.whole_word_header": "Whole word",
|
||||
"column.filters.whole_word_hint": "When the keyword or phrase is alphanumeric only, it will only be applied if it matches the whole word",
|
||||
"column.follow_requests": "Follow requests",
|
||||
"column.followers": "Followers",
|
||||
"column.following": "Following",
|
||||
|
@ -736,8 +740,14 @@
|
|||
"filters.added": "Filter added.",
|
||||
"filters.context_header": "Filter contexts",
|
||||
"filters.context_hint": "One or multiple contexts where the filter should apply",
|
||||
"filters.create_filter": "Create filter",
|
||||
"filters.filters_list_context_label": "Filter contexts:",
|
||||
"filters.filters_list_phrase_label": "Keyword or phrase:",
|
||||
"filters.filters_list_drop": "Drop",
|
||||
"filters.filters_list_expired": "Expired",
|
||||
"filters.filters_list_hide": "Hide",
|
||||
"filters.filters_list_hide_completely": "Hide content",
|
||||
"filters.filters_list_phrases_label": "Keywords or phrases:",
|
||||
"filters.filters_list_warn": "Display warning",
|
||||
"filters.removed": "Filter deleted.",
|
||||
"followRecommendations.heading": "Suggested Profiles",
|
||||
"follow_request.authorize": "Authorize",
|
||||
|
|
Loading…
Reference in a new issue