mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-13 03:26:21 +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,
|
// _filtered,
|
||||||
// Non-Mastodon
|
// Non-Mastodon
|
||||||
emojiReactions,
|
emojiReactions,
|
||||||
pleroma: {
|
pleroma: { threadMuted } = {},
|
||||||
threadMuted,
|
|
||||||
} = {}
|
|
||||||
} = status;
|
} = status;
|
||||||
|
|
||||||
const [languageAutoDetected, setLanguageAutoDetected] = useState(null);
|
const [languageAutoDetected, setLanguageAutoDetected] = useState(null);
|
||||||
|
@ -427,11 +425,23 @@ function Status({
|
||||||
const filterInfo =
|
const filterInfo =
|
||||||
!isSelf && !readOnly && !previewMode && isFiltered(filtered, filterContext);
|
!isSelf && !readOnly && !previewMode && isFiltered(filtered, filterContext);
|
||||||
|
|
||||||
const regexFilterText = snapStates.settings.regexFilter
|
const regexFilterText = snapStates.settings.regexFilter;
|
||||||
const regexFilterLines = useMemo(() => regexFilterText.split("\n").slice(0, -1), [regexFilterText])
|
const regexFilterLines = useMemo(
|
||||||
const regexFilters = useMemo(() => regexFilterLines.map(f => new RegExp(f)), [regexFilterLines])
|
() => regexFilterText.split('\n').slice(0, -1),
|
||||||
const regexFilterInfo = useMemo(() => regexFilters.map(f => content.search(f)), [regexFilters])
|
[regexFilterText],
|
||||||
const regexFilterTriggered = useMemo(() => regexFilterInfo.findIndex(f => f !== -1), [regexFilterInfo])
|
);
|
||||||
|
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') {
|
if (filterInfo?.action === 'hide') {
|
||||||
return null;
|
return null;
|
||||||
|
@ -445,8 +455,8 @@ function Status({
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if(size !== 'l') {
|
if (size !== 'l') {
|
||||||
if(filterInfo) {
|
if (filterInfo) {
|
||||||
return (
|
return (
|
||||||
<FilteredStatus
|
<FilteredStatus
|
||||||
status={status}
|
status={status}
|
||||||
|
@ -461,12 +471,12 @@ function Status({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(threadMuted) {
|
if (threadMuted) {
|
||||||
return (
|
return (
|
||||||
<FilteredStatus
|
<FilteredStatus
|
||||||
status={status}
|
status={status}
|
||||||
filterInfo={{
|
filterInfo={{
|
||||||
titlesStr: t`Thread muted`
|
titlesStr: t`Thread muted`,
|
||||||
}}
|
}}
|
||||||
instance={instance}
|
instance={instance}
|
||||||
containerProps={{
|
containerProps={{
|
||||||
|
@ -478,12 +488,12 @@ function Status({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(regexFilterTriggered >= 0) {
|
if (regexFilterTriggered >= 0) {
|
||||||
return (
|
return (
|
||||||
<FilteredStatus
|
<FilteredStatus
|
||||||
status={status}
|
status={status}
|
||||||
filterInfo={{
|
filterInfo={{
|
||||||
titlesStr: regexFilterLines[regexFilterTriggered]
|
titlesStr: regexFilterLines[regexFilterTriggered],
|
||||||
}}
|
}}
|
||||||
instance={instance}
|
instance={instance}
|
||||||
containerProps={{
|
containerProps={{
|
||||||
|
|
|
@ -683,9 +683,7 @@ function Settings({ onClose }) {
|
||||||
<li class="block">
|
<li class="block">
|
||||||
<div class="sub-section">
|
<div class="sub-section">
|
||||||
<label>
|
<label>
|
||||||
<Trans>
|
<Trans>Regex mutes</Trans>
|
||||||
Regex mutes
|
|
||||||
</Trans>
|
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="sub-section">
|
<div class="sub-section">
|
||||||
|
@ -700,7 +698,9 @@ function Settings({ onClose }) {
|
||||||
<div class="sub-section insignificant">
|
<div class="sub-section insignificant">
|
||||||
<small>
|
<small>
|
||||||
<Trans>
|
<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>
|
</Trans>
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -71,7 +71,7 @@ const states = proxy({
|
||||||
composerGIFPicker: false,
|
composerGIFPicker: false,
|
||||||
cloakMode: false,
|
cloakMode: false,
|
||||||
groupedNotificationsAlpha: false,
|
groupedNotificationsAlpha: false,
|
||||||
regexFilter: "",
|
regexFilter: '',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -108,8 +108,7 @@ export function initStates() {
|
||||||
states.settings.cloakMode = store.account.get('settings-cloakMode') ?? false;
|
states.settings.cloakMode = store.account.get('settings-cloakMode') ?? false;
|
||||||
states.settings.groupedNotificationsAlpha =
|
states.settings.groupedNotificationsAlpha =
|
||||||
store.account.get('settings-groupedNotificationsAlpha') ?? false;
|
store.account.get('settings-groupedNotificationsAlpha') ?? false;
|
||||||
states.settings.regexFilter =
|
states.settings.regexFilter = store.account.get('settings-regexFilter') ?? '';
|
||||||
store.account.get('settings-regexFilter') ?? "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
subscribeKey(states, 'notificationsLast', (v) => {
|
subscribeKey(states, 'notificationsLast', (v) => {
|
||||||
|
|
Loading…
Reference in a new issue