this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Refactor get/set accounts

+179 -162
+8 -3
src/components/account-info.jsx
··· 27 27 import showToast from '../utils/show-toast'; 28 28 import states from '../utils/states'; 29 29 import store from '../utils/store'; 30 - import { getCurrentAccountID, updateAccount } from '../utils/store-utils'; 30 + import { 31 + getAccounts, 32 + getCurrentAccountID, 33 + saveAccounts, 34 + updateAccount, 35 + } from '../utils/store-utils'; 31 36 import supports from '../utils/supports'; 32 37 33 38 import AccountBlock from './account-block'; ··· 224 229 info?.url 225 230 ); 226 231 if (isSelf && instance && infoHasEssentials) { 227 - const accounts = store.local.getJSON('accounts'); 232 + const accounts = getAccounts(); 228 233 let updated = false; 229 234 accounts.forEach((account) => { 230 235 if (account.info.id === info.id && account.instanceURL === instance) { ··· 234 239 }); 235 240 if (updated) { 236 241 console.log('Updated account info', info); 237 - store.local.setJSON('accounts', accounts); 242 + saveAccounts(accounts); 238 243 } 239 244 } 240 245 }, [isSelf, info, instance]);
+2 -2
src/components/nav-menu.jsx
··· 12 12 import safeBoundingBoxPadding from '../utils/safe-bounding-box-padding'; 13 13 import states from '../utils/states'; 14 14 import store from '../utils/store'; 15 - import { getCurrentAccountID } from '../utils/store-utils'; 15 + import { getAccounts, getCurrentAccountID } from '../utils/store-utils'; 16 16 import supports from '../utils/supports'; 17 17 18 18 import Avatar from './avatar'; ··· 27 27 const { masto, instance, authenticated } = api(); 28 28 29 29 const [currentAccount, moreThanOneAccount] = useMemo(() => { 30 - const accounts = store.local.getJSON('accounts') || []; 30 + const accounts = getAccounts(); 31 31 const acc = 32 32 accounts.find((account) => account.info.id === getCurrentAccountID()) || 33 33 accounts[0];
+141 -141
src/locales/en.po
··· 28 28 msgstr "" 29 29 30 30 #: src/components/account-block.jsx:163 31 - #: src/components/account-info.jsx:705 31 + #: src/components/account-info.jsx:710 32 32 msgid "Automated" 33 33 msgstr "" 34 34 35 35 #: src/components/account-block.jsx:170 36 - #: src/components/account-info.jsx:710 36 + #: src/components/account-info.jsx:715 37 37 #: src/components/status.jsx:589 38 38 msgid "Group" 39 39 msgstr "" ··· 43 43 msgstr "" 44 44 45 45 #: src/components/account-block.jsx:184 46 - #: src/components/account-info.jsx:1870 46 + #: src/components/account-info.jsx:1875 47 47 msgid "Requested" 48 48 msgstr "" 49 49 50 50 #: src/components/account-block.jsx:188 51 - #: src/components/account-info.jsx:1861 51 + #: src/components/account-info.jsx:1866 52 52 msgid "Following" 53 53 msgstr "" 54 54 55 55 #: src/components/account-block.jsx:192 56 - #: src/components/account-info.jsx:1175 56 + #: src/components/account-info.jsx:1180 57 57 msgid "Follows you" 58 58 msgstr "" 59 59 ··· 62 62 msgstr "" 63 63 64 64 #: src/components/account-block.jsx:209 65 - #: src/components/account-info.jsx:753 65 + #: src/components/account-info.jsx:758 66 66 msgid "Verified" 67 67 msgstr "" 68 68 69 69 #. placeholder {0}: niceDateTime(createdAt, { hideTime: true, }) 70 70 #. placeholder {0}: niceDateTime(createdAt, { hideTime: true, }) 71 71 #: src/components/account-block.jsx:224 72 - #: src/components/account-info.jsx:855 72 + #: src/components/account-info.jsx:860 73 73 msgid "Joined <0>{0}</0>" 74 74 msgstr "" 75 75 76 - #: src/components/account-info.jsx:58 76 + #: src/components/account-info.jsx:63 77 77 msgid "Forever" 78 78 msgstr "" 79 79 80 - #: src/components/account-info.jsx:398 80 + #: src/components/account-info.jsx:403 81 81 msgid "Unable to load account." 82 82 msgstr "" 83 83 84 - #: src/components/account-info.jsx:413 84 + #: src/components/account-info.jsx:418 85 85 msgid "Go to account page" 86 86 msgstr "" 87 87 88 - #: src/components/account-info.jsx:442 89 - #: src/components/account-info.jsx:775 90 - #: src/components/account-info.jsx:805 88 + #: src/components/account-info.jsx:447 89 + #: src/components/account-info.jsx:780 90 + #: src/components/account-info.jsx:810 91 91 msgid "Followers" 92 92 msgstr "" 93 93 94 94 #. js-lingui-explicit-id 95 - #: src/components/account-info.jsx:446 96 - #: src/components/account-info.jsx:815 97 - #: src/components/account-info.jsx:834 95 + #: src/components/account-info.jsx:451 96 + #: src/components/account-info.jsx:820 97 + #: src/components/account-info.jsx:839 98 98 msgid "following.stats" 99 99 msgstr "Following" 100 100 101 - #: src/components/account-info.jsx:449 102 - #: src/components/account-info.jsx:851 101 + #: src/components/account-info.jsx:454 102 + #: src/components/account-info.jsx:856 103 103 #: src/pages/account-statuses.jsx:482 104 104 #: src/pages/search.jsx:344 105 105 #: src/pages/search.jsx:491 106 106 msgid "Posts" 107 107 msgstr "" 108 108 109 - #: src/components/account-info.jsx:457 110 - #: src/components/account-info.jsx:1231 109 + #: src/components/account-info.jsx:462 110 + #: src/components/account-info.jsx:1236 111 111 #: src/components/compose.jsx:2783 112 112 #: src/components/media-alt-modal.jsx:55 113 113 #: src/components/media-modal.jsx:359 ··· 117 117 #: src/components/status.jsx:2598 118 118 #: src/components/status.jsx:2601 119 119 #: src/pages/account-statuses.jsx:526 120 - #: src/pages/accounts.jsx:113 120 + #: src/pages/accounts.jsx:118 121 121 #: src/pages/hashtag.jsx:202 122 122 #: src/pages/list.jsx:171 123 123 #: src/pages/public.jsx:116 ··· 127 127 msgid "More" 128 128 msgstr "" 129 129 130 - #: src/components/account-info.jsx:469 130 + #: src/components/account-info.jsx:474 131 131 msgid "<0>{displayName}</0> has indicated that their new account is now:" 132 132 msgstr "" 133 133 134 - #: src/components/account-info.jsx:614 135 - #: src/components/account-info.jsx:1459 134 + #: src/components/account-info.jsx:619 135 + #: src/components/account-info.jsx:1464 136 136 msgid "Handle copied" 137 137 msgstr "Handle copied" 138 138 139 - #: src/components/account-info.jsx:617 140 - #: src/components/account-info.jsx:1462 139 + #: src/components/account-info.jsx:622 140 + #: src/components/account-info.jsx:1467 141 141 msgid "Unable to copy handle" 142 142 msgstr "Unable to copy handle" 143 143 144 - #: src/components/account-info.jsx:623 145 - #: src/components/account-info.jsx:1468 144 + #: src/components/account-info.jsx:628 145 + #: src/components/account-info.jsx:1473 146 146 msgid "Copy handle" 147 147 msgstr "" 148 148 149 - #: src/components/account-info.jsx:629 149 + #: src/components/account-info.jsx:634 150 150 msgid "Go to original profile page" 151 151 msgstr "" 152 152 153 - #: src/components/account-info.jsx:647 153 + #: src/components/account-info.jsx:652 154 154 msgid "View profile image" 155 155 msgstr "" 156 156 157 - #: src/components/account-info.jsx:665 157 + #: src/components/account-info.jsx:670 158 158 msgid "View profile header" 159 159 msgstr "" 160 160 161 - #: src/components/account-info.jsx:681 162 - #: src/components/account-info.jsx:1769 163 - #: src/components/account-info.jsx:2295 161 + #: src/components/account-info.jsx:686 162 + #: src/components/account-info.jsx:1774 163 + #: src/components/account-info.jsx:2300 164 164 msgid "Edit profile" 165 165 msgstr "" 166 166 167 - #: src/components/account-info.jsx:700 167 + #: src/components/account-info.jsx:705 168 168 msgid "In Memoriam" 169 169 msgstr "" 170 170 171 - #: src/components/account-info.jsx:782 172 - #: src/components/account-info.jsx:825 171 + #: src/components/account-info.jsx:787 172 + #: src/components/account-info.jsx:830 173 173 msgid "This user has chosen to not make this information available." 174 174 msgstr "This user has chosen to not make this information available." 175 175 176 176 #. placeholder {0}: ( postingStats.originals / postingStats.total ).toLocaleString(i18n.locale || undefined, { style: 'percent', }) 177 177 #. placeholder {1}: ( postingStats.replies / postingStats.total ).toLocaleString(i18n.locale || undefined, { style: 'percent', }) 178 178 #. placeholder {2}: ( postingStats.boosts / postingStats.total ).toLocaleString(i18n.locale || undefined, { style: 'percent', }) 179 - #: src/components/account-info.jsx:880 179 + #: src/components/account-info.jsx:885 180 180 msgid "{0} original posts, {1} replies, {2} boosts" 181 181 msgstr "{0} original posts, {1} replies, {2} boosts" 182 182 ··· 187 187 #. placeholder {4}: postingStats.total 188 188 #. placeholder {5}: postingStats.total 189 189 #. placeholder {6}: postingStats.daysSinceLastPost 190 - #: src/components/account-info.jsx:896 190 + #: src/components/account-info.jsx:901 191 191 msgid "{0, plural, one {{1, plural, one {Last 1 post in the past 1 day} other {Last 1 post in the past {2} days}}} other {{3, plural, one {Last {4} posts in the past 1 day} other {Last {5} posts in the past {6} days}}}}" 192 192 msgstr "" 193 193 194 194 #. placeholder {0}: postingStats.total 195 195 #. placeholder {1}: postingStats.total 196 - #: src/components/account-info.jsx:912 196 + #: src/components/account-info.jsx:917 197 197 msgid "{0, plural, one {Last 1 post in the past year(s)} other {Last {1} posts in the past year(s)}}" 198 198 msgstr "" 199 199 200 - #: src/components/account-info.jsx:937 200 + #: src/components/account-info.jsx:942 201 201 #: src/pages/catchup.jsx:70 202 202 msgid "Original" 203 203 msgstr "" 204 204 205 - #: src/components/account-info.jsx:941 205 + #: src/components/account-info.jsx:946 206 206 #: src/components/status.jsx:2382 207 207 #: src/pages/catchup.jsx:71 208 208 #: src/pages/catchup.jsx:1448 ··· 212 212 msgid "Replies" 213 213 msgstr "" 214 214 215 - #: src/components/account-info.jsx:945 215 + #: src/components/account-info.jsx:950 216 216 #: src/pages/catchup.jsx:72 217 217 #: src/pages/catchup.jsx:1450 218 218 #: src/pages/catchup.jsx:2073 ··· 220 220 msgid "Boosts" 221 221 msgstr "" 222 222 223 - #: src/components/account-info.jsx:951 223 + #: src/components/account-info.jsx:956 224 224 msgid "Post stats unavailable." 225 225 msgstr "" 226 226 227 - #: src/components/account-info.jsx:982 227 + #: src/components/account-info.jsx:987 228 228 msgid "View post stats" 229 229 msgstr "" 230 230 231 231 #. placeholder {0}: niceDateTime(lastStatusAt, { hideTime: true, }) 232 - #: src/components/account-info.jsx:1179 232 + #: src/components/account-info.jsx:1184 233 233 msgid "Last post: <0>{0}</0>" 234 234 msgstr "" 235 235 236 - #: src/components/account-info.jsx:1193 236 + #: src/components/account-info.jsx:1198 237 237 msgid "Muted" 238 238 msgstr "" 239 239 240 - #: src/components/account-info.jsx:1198 240 + #: src/components/account-info.jsx:1203 241 241 msgid "Blocked" 242 242 msgstr "" 243 243 244 - #: src/components/account-info.jsx:1207 244 + #: src/components/account-info.jsx:1212 245 245 msgid "Private note" 246 246 msgstr "Private note" 247 247 248 - #: src/components/account-info.jsx:1264 248 + #: src/components/account-info.jsx:1269 249 249 msgid "Mention <0>@{username}</0>" 250 250 msgstr "" 251 251 252 - #: src/components/account-info.jsx:1276 252 + #: src/components/account-info.jsx:1281 253 253 msgid "Translate bio" 254 254 msgstr "" 255 255 256 - #: src/components/account-info.jsx:1287 256 + #: src/components/account-info.jsx:1292 257 257 msgid "Edit private note" 258 258 msgstr "Edit private note" 259 259 260 - #: src/components/account-info.jsx:1287 260 + #: src/components/account-info.jsx:1292 261 261 msgid "Add private note" 262 262 msgstr "Add private note" 263 263 264 - #: src/components/account-info.jsx:1307 264 + #: src/components/account-info.jsx:1312 265 265 msgid "Notifications enabled for @{username}'s posts." 266 266 msgstr "Notifications enabled for @{username}'s posts." 267 267 268 - #: src/components/account-info.jsx:1308 268 + #: src/components/account-info.jsx:1313 269 269 msgid " Notifications disabled for @{username}'s posts." 270 270 msgstr " Notifications disabled for @{username}'s posts." 271 271 272 - #: src/components/account-info.jsx:1320 272 + #: src/components/account-info.jsx:1325 273 273 msgid "Disable notifications" 274 274 msgstr "Disable notifications" 275 275 276 - #: src/components/account-info.jsx:1321 276 + #: src/components/account-info.jsx:1326 277 277 msgid "Enable notifications" 278 278 msgstr "Enable notifications" 279 279 280 - #: src/components/account-info.jsx:1338 280 + #: src/components/account-info.jsx:1343 281 281 msgid "Boosts from @{username} enabled." 282 282 msgstr "Boosts from @{username} enabled." 283 283 284 - #: src/components/account-info.jsx:1339 284 + #: src/components/account-info.jsx:1344 285 285 msgid "Boosts from @{username} disabled." 286 286 msgstr "Boosts from @{username} disabled." 287 287 288 - #: src/components/account-info.jsx:1350 288 + #: src/components/account-info.jsx:1355 289 289 msgid "Disable boosts" 290 290 msgstr "Disable boosts" 291 291 292 - #: src/components/account-info.jsx:1350 292 + #: src/components/account-info.jsx:1355 293 293 msgid "Enable boosts" 294 294 msgstr "Enable boosts" 295 295 296 - #: src/components/account-info.jsx:1369 296 + #: src/components/account-info.jsx:1374 297 297 msgid "@{username} is no longer featured on your profile." 298 298 msgstr "@{username} is no longer featured on your profile." 299 299 300 - #: src/components/account-info.jsx:1379 300 + #: src/components/account-info.jsx:1384 301 301 msgid "@{username} is now featured on your profile." 302 302 msgstr "@{username} is now featured on your profile." 303 303 304 - #: src/components/account-info.jsx:1387 304 + #: src/components/account-info.jsx:1392 305 305 msgid "Unable to unfeature @{username} on your profile." 306 306 msgstr "Unable to unfeature @{username} on your profile." 307 307 308 - #: src/components/account-info.jsx:1391 308 + #: src/components/account-info.jsx:1396 309 309 msgid "Unable to feature @{username} on your profile." 310 310 msgstr "Unable to feature @{username} on your profile." 311 311 312 - #: src/components/account-info.jsx:1400 312 + #: src/components/account-info.jsx:1405 313 313 msgid "Don't feature on profile" 314 314 msgstr "Don't feature on profile" 315 315 316 - #: src/components/account-info.jsx:1401 316 + #: src/components/account-info.jsx:1406 317 317 #: src/pages/hashtag.jsx:331 318 318 msgid "Feature on profile" 319 319 msgstr "" 320 320 321 - #: src/components/account-info.jsx:1410 321 + #: src/components/account-info.jsx:1415 322 322 msgid "Show featured profiles" 323 323 msgstr "Show featured profiles" 324 324 325 - #: src/components/account-info.jsx:1425 326 - #: src/components/account-info.jsx:1435 327 - #: src/components/account-info.jsx:2041 325 + #: src/components/account-info.jsx:1430 326 + #: src/components/account-info.jsx:1440 327 + #: src/components/account-info.jsx:2046 328 328 msgid "Add/Remove from Lists" 329 329 msgstr "" 330 330 331 - #: src/components/account-info.jsx:1485 331 + #: src/components/account-info.jsx:1490 332 332 #: src/components/status.jsx:1257 333 333 msgid "Link copied" 334 334 msgstr "" 335 335 336 - #: src/components/account-info.jsx:1488 336 + #: src/components/account-info.jsx:1493 337 337 #: src/components/status.jsx:1260 338 338 msgid "Unable to copy link" 339 339 msgstr "" 340 340 341 - #: src/components/account-info.jsx:1494 341 + #: src/components/account-info.jsx:1499 342 342 #: src/components/shortcuts-settings.jsx:1059 343 343 #: src/components/status.jsx:1266 344 344 #: src/components/status.jsx:3376 345 345 msgid "Copy" 346 346 msgstr "" 347 347 348 - #: src/components/account-info.jsx:1509 348 + #: src/components/account-info.jsx:1514 349 349 #: src/components/shortcuts-settings.jsx:1077 350 350 #: src/components/status.jsx:1282 351 351 msgid "Sharing doesn't seem to work." 352 352 msgstr "" 353 353 354 - #: src/components/account-info.jsx:1515 354 + #: src/components/account-info.jsx:1520 355 355 #: src/components/status.jsx:1288 356 356 msgid "Share…" 357 357 msgstr "" 358 358 359 - #: src/components/account-info.jsx:1535 359 + #: src/components/account-info.jsx:1540 360 360 msgid "Unmuted @{username}" 361 361 msgstr "Unmuted @{username}" 362 362 363 - #: src/components/account-info.jsx:1547 363 + #: src/components/account-info.jsx:1552 364 364 msgid "Unmute <0>@{username}</0>" 365 365 msgstr "" 366 366 367 - #: src/components/account-info.jsx:1563 367 + #: src/components/account-info.jsx:1568 368 368 msgid "Mute <0>@{username}</0>…" 369 369 msgstr "" 370 370 371 371 #. placeholder {0}: typeof MUTE_DURATIONS_LABELS[duration] === 'function' ? MUTE_DURATIONS_LABELS[duration]() : _(MUTE_DURATIONS_LABELS[duration]) 372 - #: src/components/account-info.jsx:1595 372 + #: src/components/account-info.jsx:1600 373 373 msgid "Muted @{username} for {0}" 374 374 msgstr "Muted @{username} for {0}" 375 375 376 - #: src/components/account-info.jsx:1607 376 + #: src/components/account-info.jsx:1612 377 377 msgid "Unable to mute @{username}" 378 378 msgstr "Unable to mute @{username}" 379 379 380 - #: src/components/account-info.jsx:1628 380 + #: src/components/account-info.jsx:1633 381 381 msgid "Remove <0>@{username}</0> from followers?" 382 382 msgstr "" 383 383 384 - #: src/components/account-info.jsx:1648 384 + #: src/components/account-info.jsx:1653 385 385 msgid "@{username} removed from followers" 386 386 msgstr "@{username} removed from followers" 387 387 388 - #: src/components/account-info.jsx:1660 388 + #: src/components/account-info.jsx:1665 389 389 msgid "Remove follower…" 390 390 msgstr "" 391 391 392 - #: src/components/account-info.jsx:1671 392 + #: src/components/account-info.jsx:1676 393 393 msgid "Block <0>@{username}</0>?" 394 394 msgstr "" 395 395 396 - #: src/components/account-info.jsx:1695 396 + #: src/components/account-info.jsx:1700 397 397 msgid "Unblocked @{username}" 398 398 msgstr "Unblocked @{username}" 399 399 400 - #: src/components/account-info.jsx:1703 400 + #: src/components/account-info.jsx:1708 401 401 msgid "Blocked @{username}" 402 402 msgstr "Blocked @{username}" 403 403 404 - #: src/components/account-info.jsx:1711 404 + #: src/components/account-info.jsx:1716 405 405 msgid "Unable to unblock @{username}" 406 406 msgstr "Unable to unblock @{username}" 407 407 408 - #: src/components/account-info.jsx:1713 408 + #: src/components/account-info.jsx:1718 409 409 msgid "Unable to block @{username}" 410 410 msgstr "Unable to block @{username}" 411 411 412 - #: src/components/account-info.jsx:1723 412 + #: src/components/account-info.jsx:1728 413 413 msgid "Unblock <0>@{username}</0>" 414 414 msgstr "" 415 415 416 - #: src/components/account-info.jsx:1732 416 + #: src/components/account-info.jsx:1737 417 417 msgid "Block <0>@{username}</0>…" 418 418 msgstr "" 419 419 420 - #: src/components/account-info.jsx:1749 420 + #: src/components/account-info.jsx:1754 421 421 msgid "Report <0>@{username}</0>…" 422 422 msgstr "" 423 423 424 - #: src/components/account-info.jsx:1805 424 + #: src/components/account-info.jsx:1810 425 425 msgid "Withdraw follow request?" 426 426 msgstr "Withdraw follow request?" 427 427 428 428 #. placeholder {0}: info.acct || info.username 429 - #: src/components/account-info.jsx:1806 429 + #: src/components/account-info.jsx:1811 430 430 msgid "Unfollow @{0}?" 431 431 msgstr "Unfollow @{0}?" 432 432 433 - #: src/components/account-info.jsx:1864 433 + #: src/components/account-info.jsx:1869 434 434 msgid "Unfollow…" 435 435 msgstr "" 436 436 437 - #: src/components/account-info.jsx:1873 437 + #: src/components/account-info.jsx:1878 438 438 msgid "Withdraw…" 439 439 msgstr "" 440 440 441 - #: src/components/account-info.jsx:1880 442 - #: src/components/account-info.jsx:1884 441 + #: src/components/account-info.jsx:1885 442 + #: src/components/account-info.jsx:1889 443 443 #: src/pages/hashtag.jsx:264 444 444 msgid "Follow" 445 445 msgstr "" 446 446 447 - #: src/components/account-info.jsx:1981 448 - #: src/components/account-info.jsx:2036 449 - #: src/components/account-info.jsx:2170 450 - #: src/components/account-info.jsx:2290 447 + #: src/components/account-info.jsx:1986 448 + #: src/components/account-info.jsx:2041 449 + #: src/components/account-info.jsx:2175 450 + #: src/components/account-info.jsx:2295 451 451 #: src/components/account-sheet.jsx:38 452 452 #: src/components/compose.jsx:891 453 453 #: src/components/compose.jsx:2739 ··· 469 469 #: src/components/status.jsx:3100 470 470 #: src/components/status.jsx:3340 471 471 #: src/components/status.jsx:3849 472 - #: src/pages/accounts.jsx:40 472 + #: src/pages/accounts.jsx:45 473 473 #: src/pages/catchup.jsx:1584 474 474 #: src/pages/filters.jsx:225 475 475 #: src/pages/list.jsx:302 ··· 480 480 msgid "Close" 481 481 msgstr "" 482 482 483 - #: src/components/account-info.jsx:1986 483 + #: src/components/account-info.jsx:1991 484 484 msgid "Translated Bio" 485 485 msgstr "" 486 486 487 - #: src/components/account-info.jsx:2081 487 + #: src/components/account-info.jsx:2086 488 488 msgid "Unable to remove from list." 489 489 msgstr "Unable to remove from list." 490 490 491 - #: src/components/account-info.jsx:2082 491 + #: src/components/account-info.jsx:2087 492 492 msgid "Unable to add to list." 493 493 msgstr "Unable to add to list." 494 494 495 - #: src/components/account-info.jsx:2101 495 + #: src/components/account-info.jsx:2106 496 496 #: src/pages/lists.jsx:131 497 497 msgid "Unable to load lists." 498 498 msgstr "" 499 499 500 - #: src/components/account-info.jsx:2105 500 + #: src/components/account-info.jsx:2110 501 501 msgid "No lists." 502 502 msgstr "" 503 503 504 - #: src/components/account-info.jsx:2116 504 + #: src/components/account-info.jsx:2121 505 505 #: src/components/list-add-edit.jsx:41 506 506 #: src/pages/lists.jsx:62 507 507 msgid "New list" 508 508 msgstr "" 509 509 510 510 #. placeholder {0}: account?.username || account?.acct 511 - #: src/components/account-info.jsx:2175 511 + #: src/components/account-info.jsx:2180 512 512 msgid "Private note about <0>@{0}</0>" 513 513 msgstr "" 514 514 515 - #: src/components/account-info.jsx:2205 515 + #: src/components/account-info.jsx:2210 516 516 msgid "Unable to update private note." 517 517 msgstr "Unable to update private note." 518 518 519 - #: src/components/account-info.jsx:2228 520 - #: src/components/account-info.jsx:2526 519 + #: src/components/account-info.jsx:2233 520 + #: src/components/account-info.jsx:2531 521 521 msgid "Cancel" 522 522 msgstr "" 523 523 524 - #: src/components/account-info.jsx:2233 524 + #: src/components/account-info.jsx:2238 525 525 msgid "Save & close" 526 526 msgstr "" 527 527 528 - #: src/components/account-info.jsx:2350 528 + #: src/components/account-info.jsx:2355 529 529 msgid "Unable to update profile." 530 530 msgstr "Unable to update profile." 531 531 532 - #: src/components/account-info.jsx:2357 532 + #: src/components/account-info.jsx:2362 533 533 msgid "Header picture" 534 534 msgstr "Header picture" 535 535 536 - #: src/components/account-info.jsx:2409 536 + #: src/components/account-info.jsx:2414 537 537 msgid "Profile picture" 538 538 msgstr "Profile picture" 539 539 540 - #: src/components/account-info.jsx:2461 540 + #: src/components/account-info.jsx:2466 541 541 #: src/components/list-add-edit.jsx:106 542 542 msgid "Name" 543 543 msgstr "" 544 544 545 - #: src/components/account-info.jsx:2474 545 + #: src/components/account-info.jsx:2479 546 546 msgid "Bio" 547 547 msgstr "" 548 548 549 - #: src/components/account-info.jsx:2487 549 + #: src/components/account-info.jsx:2492 550 550 msgid "Extra fields" 551 551 msgstr "" 552 552 553 - #: src/components/account-info.jsx:2493 553 + #: src/components/account-info.jsx:2498 554 554 msgid "Label" 555 555 msgstr "" 556 556 557 - #: src/components/account-info.jsx:2496 557 + #: src/components/account-info.jsx:2501 558 558 msgid "Content" 559 559 msgstr "" 560 560 561 - #: src/components/account-info.jsx:2529 561 + #: src/components/account-info.jsx:2534 562 562 #: src/components/list-add-edit.jsx:152 563 563 #: src/components/shortcuts-settings.jsx:715 564 564 #: src/pages/filters.jsx:570 ··· 566 566 msgid "Save" 567 567 msgstr "" 568 568 569 - #: src/components/account-info.jsx:2583 569 + #: src/components/account-info.jsx:2588 570 570 msgid "username" 571 571 msgstr "" 572 572 573 - #: src/components/account-info.jsx:2587 573 + #: src/components/account-info.jsx:2592 574 574 msgid "server domain name" 575 575 msgstr "" 576 576 577 577 #. placeholder {0}: info.username 578 - #: src/components/account-info.jsx:2653 578 + #: src/components/account-info.jsx:2658 579 579 msgid "Profiles featured by @{0}" 580 580 msgstr "Profiles featured by @{0}" 581 581 582 - #: src/components/account-info.jsx:2679 582 + #: src/components/account-info.jsx:2684 583 583 msgid "No featured profiles." 584 584 msgstr "No featured profiles." 585 585 ··· 1076 1076 1077 1077 #: src/components/generic-accounts.jsx:154 1078 1078 #: src/components/notification.jsx:449 1079 - #: src/pages/accounts.jsx:45 1079 + #: src/pages/accounts.jsx:50 1080 1080 #: src/pages/search.jsx:334 1081 1081 #: src/pages/search.jsx:367 1082 1082 msgid "Accounts" ··· 1983 1983 msgstr "" 1984 1984 1985 1985 #: src/components/shortcuts-settings.jsx:351 1986 - #: src/pages/accounts.jsx:183 1986 + #: src/pages/accounts.jsx:188 1987 1987 msgid "Move up" 1988 1988 msgstr "" 1989 1989 1990 1990 #: src/components/shortcuts-settings.jsx:367 1991 - #: src/pages/accounts.jsx:198 1991 + #: src/pages/accounts.jsx:203 1992 1992 msgid "Move down" 1993 1993 msgstr "" 1994 1994 ··· 2690 2690 msgid "Month" 2691 2691 msgstr "" 2692 2692 2693 - #: src/pages/accounts.jsx:59 2693 + #: src/pages/accounts.jsx:64 2694 2694 msgid "Current" 2695 2695 msgstr "" 2696 2696 2697 - #: src/pages/accounts.jsx:105 2697 + #: src/pages/accounts.jsx:110 2698 2698 msgid "Default" 2699 2699 msgstr "" 2700 2700 2701 - #: src/pages/accounts.jsx:127 2701 + #: src/pages/accounts.jsx:132 2702 2702 msgid "Switch to this account" 2703 2703 msgstr "Switch to this account" 2704 2704 2705 - #: src/pages/accounts.jsx:136 2705 + #: src/pages/accounts.jsx:141 2706 2706 msgid "Switch in new tab/window" 2707 2707 msgstr "Switch in new tab/window" 2708 2708 2709 - #: src/pages/accounts.jsx:150 2709 + #: src/pages/accounts.jsx:155 2710 2710 msgid "View profile…" 2711 2711 msgstr "" 2712 2712 2713 - #: src/pages/accounts.jsx:168 2713 + #: src/pages/accounts.jsx:173 2714 2714 msgid "Set as default" 2715 2715 msgstr "" 2716 2716 2717 2717 #. placeholder {0}: account.info.acct 2718 - #: src/pages/accounts.jsx:210 2718 + #: src/pages/accounts.jsx:215 2719 2719 msgid "Log out <0>@{0}</0>?" 2720 2720 msgstr "" 2721 2721 2722 - #: src/pages/accounts.jsx:239 2722 + #: src/pages/accounts.jsx:244 2723 2723 msgid "Log out…" 2724 2724 msgstr "" 2725 2725 2726 2726 #. placeholder {0}: niceDateTime(account.createdAt) 2727 - #: src/pages/accounts.jsx:246 2727 + #: src/pages/accounts.jsx:251 2728 2728 msgid "Connected on {0} (<0/>)" 2729 2729 msgstr "Connected on {0} (<0/>)" 2730 2730 2731 - #: src/pages/accounts.jsx:263 2731 + #: src/pages/accounts.jsx:268 2732 2732 msgid "Add an existing account" 2733 2733 msgstr "" 2734 2734 2735 - #: src/pages/accounts.jsx:270 2735 + #: src/pages/accounts.jsx:275 2736 2736 msgid "Note: <0>Default</0> account will always be used for first load. Switched accounts will persist during the session." 2737 2737 msgstr "" 2738 2738
+12 -7
src/pages/accounts.jsx
··· 18 18 import niceDateTime from '../utils/nice-date-time'; 19 19 import states from '../utils/states'; 20 20 import store from '../utils/store'; 21 - import { getCurrentAccountID, setCurrentAccountID } from '../utils/store-utils'; 21 + import { 22 + getAccounts, 23 + getCurrentAccountID, 24 + saveAccounts, 25 + setCurrentAccountID, 26 + } from '../utils/store-utils'; 22 27 23 28 const isStandalone = window.matchMedia('(display-mode: standalone)').matches; 24 29 ··· 26 31 const { t } = useLingui(); 27 32 const { masto } = api(); 28 33 // Accounts 29 - const accounts = store.local.getJSON('accounts'); 34 + const accounts = getAccounts(); 30 35 const currentAccount = getCurrentAccountID(); 31 36 const moreThanOneAccount = accounts.length > 1; 32 37 ··· 70 75 .fetch(); 71 76 console.log('fetched account info', info); 72 77 account.info = info; 73 - store.local.setJSON('accounts', accounts); 78 + saveAccounts(accounts); 74 79 reload(); 75 80 } catch (e) {} 76 81 } ··· 159 164 // Move account to the top of the list 160 165 accounts.splice(i, 1); 161 166 accounts.unshift(account); 162 - store.local.setJSON('accounts', accounts); 167 + saveAccounts(accounts); 163 168 reload(); 164 169 }} 165 170 > ··· 174 179 // Move account one position up 175 180 accounts.splice(i, 1); 176 181 accounts.splice(i - 1, 0, account); 177 - store.local.setJSON('accounts', accounts); 182 + saveAccounts(accounts); 178 183 reload(); 179 184 }} 180 185 > ··· 189 194 // Move account one position down 190 195 accounts.splice(i, 1); 191 196 accounts.splice(i + 1, 0, account); 192 - store.local.setJSON('accounts', accounts); 197 + saveAccounts(accounts); 193 198 reload(); 194 199 }} 195 200 > ··· 229 234 token: account.accessToken, 230 235 }); 231 236 accounts.splice(i, 1); 232 - store.local.setJSON('accounts', accounts); 237 + saveAccounts(accounts); 233 238 // location.reload(); 234 239 location.href = location.pathname || '/'; 235 240 }}
+16 -9
src/utils/store-utils.js
··· 1 1 import store from './store'; 2 2 3 + export function getAccounts() { 4 + return store.local.getJSON('accounts') || []; 5 + } 6 + 7 + export function saveAccounts(accounts) { 8 + store.local.setJSON('accounts', accounts); 9 + } 10 + 3 11 export function getAccount(id) { 4 - const accounts = store.local.getJSON('accounts') || []; 12 + const accounts = getAccounts(); 5 13 if (!id) return accounts[0]; 6 14 return accounts.find((a) => a.info.id === id) || accounts[0]; 7 15 } 8 16 9 17 export function getAccountByAccessToken(accessToken) { 10 - const accounts = store.local.getJSON('accounts') || []; 18 + const accounts = getAccounts(); 11 19 return accounts.find((a) => a.accessToken === accessToken); 12 20 } 13 21 14 22 export function getAccountByInstance(instance) { 15 - const accounts = store.local.getJSON('accounts') || []; 23 + const accounts = getAccounts(); 16 24 return accounts.find((a) => a.instanceURL === instance); 17 25 } 18 26 19 27 export function hasAccountInInstance(instance) { 20 - const accounts = store.local.getJSON('accounts') || []; 28 + const accounts = getAccounts(); 21 29 return accounts.some((a) => a.instanceURL === instance); 22 30 } 23 31 ··· 69 77 } 70 78 71 79 export function saveAccount(account) { 72 - const accounts = store.local.getJSON('accounts') || []; 80 + const accounts = getAccounts(); 73 81 const acc = accounts.find((a) => a.info.id === account.info.id); 74 82 if (acc) { 75 83 acc.info = account.info; ··· 79 87 } else { 80 88 accounts.push(account); 81 89 } 82 - store.local.setJSON('accounts', accounts); 83 - setCurrentAccountID(account.info.id); 90 + saveAccounts(accounts); 84 91 } 85 92 86 93 export function updateAccount(accountInfo) { 87 94 // Only update if displayName or avatar or avatar_static is different 88 - const accounts = store.local.getJSON('accounts') || []; 95 + const accounts = getAccounts(); 89 96 const acc = accounts.find((a) => a.info.id === accountInfo.id); 90 97 if (acc) { 91 98 if ( ··· 97 104 ...acc.info, 98 105 ...accountInfo, 99 106 }; 100 - store.local.setJSON('accounts', accounts); 107 + saveAccounts(accounts); 101 108 } 102 109 } 103 110 }