mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-02 06:06:41 +01:00
Run prettier
This commit is contained in:
parent
4298146595
commit
d0a141e31b
3 changed files with 34 additions and 25 deletions
|
@ -393,9 +393,7 @@ function Status({
|
|||
// _filtered,
|
||||
// Non-Mastodon
|
||||
emojiReactions,
|
||||
pleroma: {
|
||||
threadMuted,
|
||||
} = {}
|
||||
pleroma: { threadMuted } = {},
|
||||
} = status;
|
||||
|
||||
const [languageAutoDetected, setLanguageAutoDetected] = useState(null);
|
||||
|
@ -426,12 +424,24 @@ function Status({
|
|||
const filterContext = useContext(FilterContext);
|
||||
const filterInfo =
|
||||
!isSelf && !readOnly && !previewMode && isFiltered(filtered, filterContext);
|
||||
|
||||
const regexFilterText = snapStates.settings.regexFilter
|
||||
const regexFilterLines = useMemo(() => regexFilterText.split("\n").slice(0, -1), [regexFilterText])
|
||||
const regexFilters = useMemo(() => regexFilterLines.map(f => new RegExp(f)), [regexFilterLines])
|
||||
const regexFilterInfo = useMemo(() => regexFilters.map(f => content.search(f)), [regexFilters])
|
||||
const regexFilterTriggered = useMemo(() => regexFilterInfo.findIndex(f => f !== -1), [regexFilterInfo])
|
||||
|
||||
const regexFilterText = snapStates.settings.regexFilter;
|
||||
const regexFilterLines = useMemo(
|
||||
() => regexFilterText.split('\n').slice(0, -1),
|
||||
[regexFilterText],
|
||||
);
|
||||
const regexFilters = useMemo(
|
||||
() => regexFilterLines.map((f) => new RegExp(f)),
|
||||
[regexFilterLines],
|
||||
);
|
||||
const regexFilterInfo = useMemo(
|
||||
() => regexFilters.map((f) => content.search(f)),
|
||||
[regexFilters],
|
||||
);
|
||||
const regexFilterTriggered = useMemo(
|
||||
() => regexFilterInfo.findIndex((f) => f !== -1),
|
||||
[regexFilterInfo],
|
||||
);
|
||||
|
||||
if (filterInfo?.action === 'hide') {
|
||||
return null;
|
||||
|
@ -445,8 +455,8 @@ function Status({
|
|||
}
|
||||
};
|
||||
|
||||
if(size !== 'l') {
|
||||
if(filterInfo) {
|
||||
if (size !== 'l') {
|
||||
if (filterInfo) {
|
||||
return (
|
||||
<FilteredStatus
|
||||
status={status}
|
||||
|
@ -460,13 +470,13 @@ function Status({
|
|||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if(threadMuted) {
|
||||
|
||||
if (threadMuted) {
|
||||
return (
|
||||
<FilteredStatus
|
||||
status={status}
|
||||
filterInfo={{
|
||||
titlesStr: t`Thread muted`
|
||||
titlesStr: t`Thread muted`,
|
||||
}}
|
||||
instance={instance}
|
||||
containerProps={{
|
||||
|
@ -477,13 +487,13 @@ function Status({
|
|||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if(regexFilterTriggered >= 0) {
|
||||
|
||||
if (regexFilterTriggered >= 0) {
|
||||
return (
|
||||
<FilteredStatus
|
||||
status={status}
|
||||
filterInfo={{
|
||||
titlesStr: regexFilterLines[regexFilterTriggered]
|
||||
titlesStr: regexFilterLines[regexFilterTriggered],
|
||||
}}
|
||||
instance={instance}
|
||||
containerProps={{
|
||||
|
@ -3582,7 +3592,7 @@ function StatusCompact({ sKey }) {
|
|||
const filterInfo = isFiltered(filtered, filterContext);
|
||||
|
||||
if (filterInfo?.action === 'hide') return null;
|
||||
|
||||
|
||||
console.debug('RENDER Status', id, status?.account.displayName, quoted);
|
||||
|
||||
const filterTitleStr = filterInfo?.titlesStr || '';
|
||||
|
|
|
@ -683,9 +683,7 @@ function Settings({ onClose }) {
|
|||
<li class="block">
|
||||
<div class="sub-section">
|
||||
<label>
|
||||
<Trans>
|
||||
Regex mutes
|
||||
</Trans>
|
||||
<Trans>Regex mutes</Trans>
|
||||
</label>
|
||||
</div>
|
||||
<div class="sub-section">
|
||||
|
@ -700,7 +698,9 @@ function Settings({ onClose }) {
|
|||
<div class="sub-section insignificant">
|
||||
<small>
|
||||
<Trans>
|
||||
Mute posts matching these regular expressions. One per line. Make sure that the final regular expression is terminated by a newline character, or it won't be parsed!
|
||||
Mute posts matching these regular expressions. One per line.
|
||||
Make sure that the final regular expression is terminated by
|
||||
a newline character, or it won't be parsed!
|
||||
</Trans>
|
||||
</small>
|
||||
</div>
|
||||
|
|
|
@ -71,7 +71,7 @@ const states = proxy({
|
|||
composerGIFPicker: false,
|
||||
cloakMode: false,
|
||||
groupedNotificationsAlpha: false,
|
||||
regexFilter: "",
|
||||
regexFilter: '',
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -108,8 +108,7 @@ export function initStates() {
|
|||
states.settings.cloakMode = store.account.get('settings-cloakMode') ?? false;
|
||||
states.settings.groupedNotificationsAlpha =
|
||||
store.account.get('settings-groupedNotificationsAlpha') ?? false;
|
||||
states.settings.regexFilter =
|
||||
store.account.get('settings-regexFilter') ?? "";
|
||||
states.settings.regexFilter = store.account.get('settings-regexFilter') ?? '';
|
||||
}
|
||||
|
||||
subscribeKey(states, 'notificationsLast', (v) => {
|
||||
|
|
Loading…
Reference in a new issue