kopia lustrzana https://github.com/cheeaun/phanpy
Allow arrange accounts
rodzic
3ba97ad414
commit
b718a29921
|
@ -16,6 +16,7 @@ export const ICONS = {
|
||||||
},
|
},
|
||||||
'arrow-up': () => import('@iconify-icons/mingcute/arrow-up-line'),
|
'arrow-up': () => import('@iconify-icons/mingcute/arrow-up-line'),
|
||||||
'arrow-down': () => import('@iconify-icons/mingcute/arrow-down-line'),
|
'arrow-down': () => import('@iconify-icons/mingcute/arrow-down-line'),
|
||||||
|
'arrow-to-up-line': () => import('@iconify-icons/mingcute/arrow-to-up-line'),
|
||||||
earth: () => import('@iconify-icons/mingcute/earth-line'),
|
earth: () => import('@iconify-icons/mingcute/earth-line'),
|
||||||
lock: () => import('@iconify-icons/mingcute/lock-line'),
|
lock: () => import('@iconify-icons/mingcute/lock-line'),
|
||||||
unlock: () => import('@iconify-icons/mingcute/unlock-line'),
|
unlock: () => import('@iconify-icons/mingcute/unlock-line'),
|
||||||
|
|
|
@ -117,7 +117,7 @@ msgstr ""
|
||||||
#: src/components/status.jsx:2598
|
#: src/components/status.jsx:2598
|
||||||
#: src/components/status.jsx:2601
|
#: src/components/status.jsx:2601
|
||||||
#: src/pages/account-statuses.jsx:526
|
#: src/pages/account-statuses.jsx:526
|
||||||
#: src/pages/accounts.jsx:113
|
#: src/pages/accounts.jsx:114
|
||||||
#: src/pages/hashtag.jsx:202
|
#: src/pages/hashtag.jsx:202
|
||||||
#: src/pages/list.jsx:171
|
#: src/pages/list.jsx:171
|
||||||
#: src/pages/public.jsx:116
|
#: src/pages/public.jsx:116
|
||||||
|
@ -469,7 +469,7 @@ msgstr ""
|
||||||
#: src/components/status.jsx:3100
|
#: src/components/status.jsx:3100
|
||||||
#: src/components/status.jsx:3340
|
#: src/components/status.jsx:3340
|
||||||
#: src/components/status.jsx:3849
|
#: src/components/status.jsx:3849
|
||||||
#: src/pages/accounts.jsx:40
|
#: src/pages/accounts.jsx:41
|
||||||
#: src/pages/catchup.jsx:1584
|
#: src/pages/catchup.jsx:1584
|
||||||
#: src/pages/filters.jsx:225
|
#: src/pages/filters.jsx:225
|
||||||
#: src/pages/list.jsx:302
|
#: src/pages/list.jsx:302
|
||||||
|
@ -1076,7 +1076,7 @@ msgstr ""
|
||||||
|
|
||||||
#: src/components/generic-accounts.jsx:154
|
#: src/components/generic-accounts.jsx:154
|
||||||
#: src/components/notification.jsx:449
|
#: src/components/notification.jsx:449
|
||||||
#: src/pages/accounts.jsx:45
|
#: src/pages/accounts.jsx:46
|
||||||
#: src/pages/search.jsx:334
|
#: src/pages/search.jsx:334
|
||||||
#: src/pages/search.jsx:367
|
#: src/pages/search.jsx:367
|
||||||
msgid "Accounts"
|
msgid "Accounts"
|
||||||
|
@ -1983,10 +1983,12 @@ msgid "Not available in current view mode"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/components/shortcuts-settings.jsx:351
|
#: src/components/shortcuts-settings.jsx:351
|
||||||
|
#: src/pages/accounts.jsx:201
|
||||||
msgid "Move up"
|
msgid "Move up"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/components/shortcuts-settings.jsx:367
|
#: src/components/shortcuts-settings.jsx:367
|
||||||
|
#: src/pages/accounts.jsx:216
|
||||||
msgid "Move down"
|
msgid "Move down"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -2688,49 +2690,53 @@ msgstr ""
|
||||||
msgid "Month"
|
msgid "Month"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/accounts.jsx:59
|
#: src/pages/accounts.jsx:60
|
||||||
msgid "Current"
|
msgid "Current"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/accounts.jsx:105
|
#: src/pages/accounts.jsx:106
|
||||||
msgid "Default"
|
msgid "Default"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/accounts.jsx:127
|
#: src/pages/accounts.jsx:128
|
||||||
msgid "Switch to this account"
|
msgid "Switch to this account"
|
||||||
msgstr "Switch to this account"
|
msgstr "Switch to this account"
|
||||||
|
|
||||||
#: src/pages/accounts.jsx:136
|
#: src/pages/accounts.jsx:137
|
||||||
msgid "Switch in new tab/window"
|
msgid "Switch in new tab/window"
|
||||||
msgstr "Switch in new tab/window"
|
msgstr "Switch in new tab/window"
|
||||||
|
|
||||||
#: src/pages/accounts.jsx:150
|
#: src/pages/accounts.jsx:151
|
||||||
msgid "View profile…"
|
msgid "View profile…"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/accounts.jsx:167
|
#: src/pages/accounts.jsx:169
|
||||||
msgid "Set as default"
|
msgid "Set as default"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/pages/accounts.jsx:185
|
||||||
|
msgid "Move to top"
|
||||||
|
msgstr "Move to top"
|
||||||
|
|
||||||
#. placeholder {0}: account.info.acct
|
#. placeholder {0}: account.info.acct
|
||||||
#: src/pages/accounts.jsx:177
|
#: src/pages/accounts.jsx:228
|
||||||
msgid "Log out <0>@{0}</0>?"
|
msgid "Log out <0>@{0}</0>?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/accounts.jsx:206
|
#: src/pages/accounts.jsx:257
|
||||||
msgid "Log out…"
|
msgid "Log out…"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. placeholder {0}: niceDateTime(account.createdAt)
|
#. placeholder {0}: niceDateTime(account.createdAt)
|
||||||
#: src/pages/accounts.jsx:213
|
#: src/pages/accounts.jsx:264
|
||||||
msgid "Connected on {0} (<0/>)"
|
msgid "Connected on {0} (<0/>)"
|
||||||
msgstr "Connected on {0} (<0/>)"
|
msgstr "Connected on {0} (<0/>)"
|
||||||
|
|
||||||
#: src/pages/accounts.jsx:230
|
#: src/pages/accounts.jsx:281
|
||||||
msgid "Add an existing account"
|
msgid "Add an existing account"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/accounts.jsx:237
|
#: src/pages/accounts.jsx:288
|
||||||
msgid "Note: <0>Default</0> account will always be used for first load. Switched accounts will persist during the session."
|
msgid "Note: <0>Default</0> account will always be used for first load. Switched accounts will persist during the session."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ function Accounts({ onClose }) {
|
||||||
const accounts = store.local.getJSON('accounts');
|
const accounts = store.local.getJSON('accounts');
|
||||||
const currentAccount = getCurrentAccountID();
|
const currentAccount = getCurrentAccountID();
|
||||||
const moreThanOneAccount = accounts.length > 1;
|
const moreThanOneAccount = accounts.length > 1;
|
||||||
|
const moreThanThreeAccounts = accounts.length > 3;
|
||||||
|
|
||||||
const [_, reload] = useReducer((x) => x + 1, 0);
|
const [_, reload] = useReducer((x) => x + 1, 0);
|
||||||
const [accountsListParent] = useAutoAnimate();
|
const [accountsListParent] = useAutoAnimate();
|
||||||
|
@ -152,21 +153,71 @@ function Accounts({ onClose }) {
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuDivider />
|
<MenuDivider />
|
||||||
{moreThanOneAccount && (
|
{moreThanOneAccount && (
|
||||||
<MenuItem
|
<>
|
||||||
disabled={isDefault}
|
<MenuItem
|
||||||
onClick={() => {
|
disabled={isDefault}
|
||||||
// Move account to the top of the list
|
onClick={() => {
|
||||||
accounts.splice(i, 1);
|
// Move account to the top of the list
|
||||||
accounts.unshift(account);
|
accounts.splice(i, 1);
|
||||||
store.local.setJSON('accounts', accounts);
|
accounts.unshift(account);
|
||||||
reload();
|
store.local.setJSON('accounts', accounts);
|
||||||
}}
|
reload();
|
||||||
>
|
}}
|
||||||
<Icon icon="check-circle" />
|
>
|
||||||
<span>
|
<Icon icon="check-circle" />
|
||||||
<Trans>Set as default</Trans>
|
<span>
|
||||||
</span>
|
<Trans>Set as default</Trans>
|
||||||
</MenuItem>
|
</span>
|
||||||
|
</MenuItem>
|
||||||
|
{moreThanThreeAccounts && (
|
||||||
|
<MenuItem
|
||||||
|
disabled={i <= 2}
|
||||||
|
onClick={() => {
|
||||||
|
// Move account to position 1 (right below default)
|
||||||
|
accounts.splice(i, 1);
|
||||||
|
accounts.splice(1, 0, account);
|
||||||
|
store.local.setJSON('accounts', accounts);
|
||||||
|
reload();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Icon icon="arrow-to-up-line" />
|
||||||
|
<span>
|
||||||
|
<Trans>Move to top</Trans>
|
||||||
|
</span>
|
||||||
|
</MenuItem>
|
||||||
|
)}
|
||||||
|
<MenuItem
|
||||||
|
disabled={i <= 1}
|
||||||
|
onClick={() => {
|
||||||
|
// Move account one position up
|
||||||
|
accounts.splice(i, 1);
|
||||||
|
accounts.splice(i - 1, 0, account);
|
||||||
|
store.local.setJSON('accounts', accounts);
|
||||||
|
reload();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Icon icon="arrow-up" />
|
||||||
|
<span>
|
||||||
|
<Trans>Move up</Trans>
|
||||||
|
</span>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem
|
||||||
|
disabled={i === 0 || i === accounts.length - 1}
|
||||||
|
onClick={() => {
|
||||||
|
// Move account one position down
|
||||||
|
accounts.splice(i, 1);
|
||||||
|
accounts.splice(i + 1, 0, account);
|
||||||
|
store.local.setJSON('accounts', accounts);
|
||||||
|
reload();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Icon icon="arrow-down" />
|
||||||
|
<span>
|
||||||
|
<Trans>Move down</Trans>
|
||||||
|
</span>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuDivider />
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
<MenuConfirm
|
<MenuConfirm
|
||||||
subMenu
|
subMenu
|
||||||
|
|
Ładowanie…
Reference in New Issue