* Add: #920 アンテナ・リストに「お気に入りに登録」設定 * Fix test * Fix test * Add fedibird capabilities * Add kmyblue_favourite_antenna
This commit is contained in:
parent
ee49518125
commit
9201eb151b
22 changed files with 294 additions and 29 deletions
|
@ -10,6 +10,7 @@ export interface ApiAntennaJSON {
|
|||
insert_feeds: boolean;
|
||||
with_media_only: boolean;
|
||||
ignore_reblog: boolean;
|
||||
favourite: boolean;
|
||||
list: ApiListJSON | null;
|
||||
|
||||
list_id: string | undefined;
|
||||
|
|
|
@ -10,5 +10,6 @@ export interface ApiListJSON {
|
|||
exclusive: boolean;
|
||||
replies_policy: RepliesPolicyType;
|
||||
notify: boolean;
|
||||
favourite: boolean;
|
||||
antennas?: ApiAntennaJSON[];
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ const NewAntenna: React.FC<{
|
|||
const [ignoreReblog, setIgnoreReblog] = useState(false);
|
||||
const [mode, setMode] = useState('filtering');
|
||||
const [destination, setDestination] = useState('timeline');
|
||||
const [favourite, setFavourite] = useState(true);
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -80,6 +81,7 @@ const NewAntenna: React.FC<{
|
|||
setListId(antenna.list?.id ?? '0');
|
||||
setWithMediaOnly(antenna.with_media_only);
|
||||
setIgnoreReblog(antenna.ignore_reblog);
|
||||
setFavourite(antenna.favourite);
|
||||
|
||||
if (antenna.stl) {
|
||||
setMode('stl');
|
||||
|
@ -109,6 +111,7 @@ const NewAntenna: React.FC<{
|
|||
setIgnoreReblog,
|
||||
setMode,
|
||||
setDestination,
|
||||
setFavourite,
|
||||
id,
|
||||
antenna,
|
||||
lists,
|
||||
|
@ -179,6 +182,13 @@ const NewAntenna: React.FC<{
|
|||
[setIgnoreReblog],
|
||||
);
|
||||
|
||||
const handleFavouriteChange = useCallback(
|
||||
({ target: { checked } }: React.ChangeEvent<HTMLInputElement>) => {
|
||||
setFavourite(checked);
|
||||
},
|
||||
[setFavourite],
|
||||
);
|
||||
|
||||
const handleSubmit = useCallback(() => {
|
||||
setSubmitting(true);
|
||||
|
||||
|
@ -193,6 +203,7 @@ const NewAntenna: React.FC<{
|
|||
list_id: destination === 'list' ? listId : '0',
|
||||
with_media_only: withMediaOnly,
|
||||
ignore_reblog: ignoreReblog,
|
||||
favourite,
|
||||
}),
|
||||
).then(() => {
|
||||
setSubmitting(false);
|
||||
|
@ -208,6 +219,7 @@ const NewAntenna: React.FC<{
|
|||
list_id: destination === 'list' ? listId : '0',
|
||||
with_media_only: withMediaOnly,
|
||||
ignore_reblog: ignoreReblog,
|
||||
favourite,
|
||||
}),
|
||||
).then((result) => {
|
||||
setSubmitting(false);
|
||||
|
@ -233,6 +245,7 @@ const NewAntenna: React.FC<{
|
|||
withMediaOnly,
|
||||
ignoreReblog,
|
||||
destination,
|
||||
favourite,
|
||||
]);
|
||||
|
||||
return (
|
||||
|
@ -460,6 +473,35 @@ const NewAntenna: React.FC<{
|
|||
</>
|
||||
)}
|
||||
|
||||
<div className='fields-group'>
|
||||
{/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
|
||||
<label className='app-form__toggle'>
|
||||
<div className='app-form__toggle__label'>
|
||||
<strong>
|
||||
<FormattedMessage
|
||||
id='antennas.favourite'
|
||||
defaultMessage='Favorite'
|
||||
/>
|
||||
</strong>
|
||||
<span className='hint'>
|
||||
<FormattedMessage
|
||||
id='antennas.favourite_hint'
|
||||
defaultMessage='When opening the Web Client on a PC, this antenna appears in the navigation.'
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className='app-form__toggle__toggle'>
|
||||
<div>
|
||||
<Toggle
|
||||
checked={favourite}
|
||||
onChange={handleFavouriteChange}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div className='actions'>
|
||||
<button className='button' type='submit'>
|
||||
{submitting ? (
|
||||
|
|
|
@ -82,6 +82,7 @@ const NewList: React.FC<{
|
|||
const [exclusive, setExclusive] = useState(false);
|
||||
const [repliesPolicy, setRepliesPolicy] = useState<RepliesPolicyType>('list');
|
||||
const [notify, setNotify] = useState(false);
|
||||
const [favourite, setFavourite] = useState(true);
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -96,8 +97,17 @@ const NewList: React.FC<{
|
|||
setExclusive(list.exclusive);
|
||||
setRepliesPolicy(list.replies_policy);
|
||||
setNotify(list.notify);
|
||||
setFavourite(list.favourite);
|
||||
}
|
||||
}, [setTitle, setExclusive, setRepliesPolicy, setNotify, id, list]);
|
||||
}, [
|
||||
setTitle,
|
||||
setExclusive,
|
||||
setRepliesPolicy,
|
||||
setNotify,
|
||||
setFavourite,
|
||||
id,
|
||||
list,
|
||||
]);
|
||||
|
||||
const handleTitleChange = useCallback(
|
||||
({ target: { value } }: React.ChangeEvent<HTMLInputElement>) => {
|
||||
|
@ -127,6 +137,13 @@ const NewList: React.FC<{
|
|||
[setNotify],
|
||||
);
|
||||
|
||||
const handleFavouriteChange = useCallback(
|
||||
({ target: { checked } }: React.ChangeEvent<HTMLInputElement>) => {
|
||||
setFavourite(checked);
|
||||
},
|
||||
[setFavourite],
|
||||
);
|
||||
|
||||
const handleSubmit = useCallback(() => {
|
||||
setSubmitting(true);
|
||||
|
||||
|
@ -138,6 +155,7 @@ const NewList: React.FC<{
|
|||
exclusive,
|
||||
replies_policy: repliesPolicy,
|
||||
notify,
|
||||
favourite,
|
||||
}),
|
||||
).then(() => {
|
||||
setSubmitting(false);
|
||||
|
@ -150,6 +168,7 @@ const NewList: React.FC<{
|
|||
exclusive,
|
||||
replies_policy: repliesPolicy,
|
||||
notify,
|
||||
favourite,
|
||||
}),
|
||||
).then((result) => {
|
||||
setSubmitting(false);
|
||||
|
@ -171,6 +190,7 @@ const NewList: React.FC<{
|
|||
exclusive,
|
||||
repliesPolicy,
|
||||
notify,
|
||||
favourite,
|
||||
]);
|
||||
|
||||
return (
|
||||
|
@ -324,6 +344,35 @@ const NewList: React.FC<{
|
|||
</label>
|
||||
</div>
|
||||
|
||||
<div className='fields-group'>
|
||||
{/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
|
||||
<label className='app-form__toggle'>
|
||||
<div className='app-form__toggle__label'>
|
||||
<strong>
|
||||
<FormattedMessage
|
||||
id='lists.favourite'
|
||||
defaultMessage='Favorite'
|
||||
/>
|
||||
</strong>
|
||||
<span className='hint'>
|
||||
<FormattedMessage
|
||||
id='lists.favourite_hint'
|
||||
defaultMessage='When opening the Web Client on a PC, this list appears in the navigation.'
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className='app-form__toggle__toggle'>
|
||||
<div>
|
||||
<Toggle
|
||||
checked={favourite}
|
||||
onChange={handleFavouriteChange}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div className='actions'>
|
||||
<button className='button' type='submit'>
|
||||
{submitting ? (
|
||||
|
|
|
@ -16,7 +16,7 @@ const getOrderedLists = createSelector([state => state.get('lists')], lists => {
|
|||
return lists;
|
||||
}
|
||||
|
||||
return lists.toList().filter(item => !!item).sort((a, b) => a.get('title').localeCompare(b.get('title'))).take(8);
|
||||
return lists.toList().filter(item => !!item && item.get('favourite')).sort((a, b) => a.get('title').localeCompare(b.get('title'))).take(8);
|
||||
});
|
||||
|
||||
const getOrderedAntennas = createSelector([state => state.get('antennas')], antennas => {
|
||||
|
@ -24,7 +24,7 @@ const getOrderedAntennas = createSelector([state => state.get('antennas')], ante
|
|||
return antennas;
|
||||
}
|
||||
|
||||
return antennas.toList().filter(item => !!item && !item.get('insert_feeds') && item.get('title') !== undefined).sort((a, b) => a.get('title').localeCompare(b.get('title'))).take(8);
|
||||
return antennas.toList().filter(item => !!item && item.get('favourite') && item.get('title') !== undefined).sort((a, b) => a.get('title').localeCompare(b.get('title'))).take(8);
|
||||
});
|
||||
|
||||
export const ListPanel = () => {
|
||||
|
|
|
@ -150,6 +150,8 @@
|
|||
"antennas.exclude_domains": "Exclude domains",
|
||||
"antennas.exclude_keywords": "Exclude keywords",
|
||||
"antennas.exclude_tags": "Exclude tags",
|
||||
"antennas.favourite": "Favorite",
|
||||
"antennas.favourite_hint": "When opening the Web Client on a PC, this antenna appears in the navigation.",
|
||||
"antennas.filter_items": "Move to antenna filter setting",
|
||||
"antennas.filter_not": "Filter Not",
|
||||
"antennas.find_users_to_add": "Find users to add",
|
||||
|
@ -630,6 +632,8 @@
|
|||
"lists.edit": "Edit list",
|
||||
"lists.exclusive": "Hide members in Home",
|
||||
"lists.exclusive_hint": "If someone is on this list, hide them in your Home feed to avoid seeing their posts twice.",
|
||||
"lists.favourite": "Favorite",
|
||||
"lists.favourite_hint": "When opening the Web Client on a PC, this list appears in the navigation.",
|
||||
"lists.find_users_to_add": "Find users to add",
|
||||
"lists.list_members": "List members",
|
||||
"lists.list_members_count": "{count, plural, one {# member} other {# members}}",
|
||||
|
|
|
@ -145,6 +145,8 @@
|
|||
"antennas.exclude_domains": "除外するドメイン",
|
||||
"antennas.exclude_keywords": "除外するキーワード",
|
||||
"antennas.exclude_tags": "除外するタグ",
|
||||
"antennas.favourite": "お気に入りに登録",
|
||||
"antennas.favourite_hint": "お気に入りに登録したアンテナは、Webクライアントでナビゲーションに表示されます",
|
||||
"antennas.filter_items": "絞り込み条件の設定に移動",
|
||||
"antennas.filter_not": "絞り込み条件の例外",
|
||||
"antennas.ignore_reblog": "ブーストを除外",
|
||||
|
@ -579,6 +581,8 @@
|
|||
"lists.antennas": "関連付けられたアンテナ",
|
||||
"lists.delete": "リストを削除",
|
||||
"lists.edit": "リストを編集",
|
||||
"lists.favourite": "お気に入りに登録",
|
||||
"lists.favourite_hint": "お気に入りに登録したリストは、Webクライアントでナビゲーションに表示されます",
|
||||
"lists.memo_related_antenna": "アンテナ: {title}",
|
||||
"lists.notify": "これらの投稿を通知する",
|
||||
"lists.replies_policy.followed": "フォロー中のユーザー全員",
|
||||
|
|
|
@ -14,6 +14,7 @@ const AntennaFactory = Record<AntennaShape>({
|
|||
insert_feeds: false,
|
||||
with_media_only: false,
|
||||
ignore_reblog: false,
|
||||
favourite: true,
|
||||
list: null,
|
||||
list_id: undefined,
|
||||
});
|
||||
|
|
|
@ -12,6 +12,7 @@ const ListFactory = Record<ListShape>({
|
|||
exclusive: false,
|
||||
replies_policy: 'list',
|
||||
notify: false,
|
||||
favourite: true,
|
||||
antennas: [],
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue