Compare commits
839 commits
Author | SHA1 | Date | |
---|---|---|---|
9264207406 | |||
4babfe9c46 | |||
fe3f416f54 | |||
69506f7d99 | |||
![]() |
78fd25ac10 | ||
![]() |
7fc8aa7bc2 | ||
f8a702704f | |||
![]() |
da26c38e59 | ||
![]() |
e8e2192e75 | ||
2d6ba0cab5 | |||
1db09a2a41 | |||
7f733512a2 | |||
![]() |
31364c1b63 | ||
e170e22621 | |||
078ca947aa | |||
a57ce2db7b | |||
![]() |
317929504e | ||
![]() |
3ef80d56ef | ||
![]() |
cfb68319fe | ||
![]() |
f3d1ac9fca | ||
5b073ee32a | |||
ebf11b5d57 | |||
2780036983 | |||
f202edd5fd | |||
a876d81f51 | |||
e09e4d5b4d | |||
![]() |
b8144db9ac | ||
![]() |
b320b37e52 | ||
![]() |
167f6d78b4 | ||
![]() |
379ab78db3 | ||
![]() |
3adcce4e36 | ||
![]() |
1d128f56f9 | ||
![]() |
190be77043 | ||
![]() |
a51f8f172a | ||
![]() |
8b6f15a214 | ||
![]() |
dd2148095a | ||
![]() |
4f5648f151 | ||
![]() |
548183e14a | ||
![]() |
e12b1d2b6c | ||
![]() |
f4567dcacc | ||
![]() |
d3bffd1da2 | ||
![]() |
d22579fd89 | ||
![]() |
73f6790d01 | ||
![]() |
b669514243 | ||
![]() |
df9554e7ae | ||
![]() |
1d485c91b1 | ||
![]() |
a5ec0cbd3f | ||
![]() |
5f55a5928a | ||
![]() |
220189abd8 | ||
![]() |
a3fbc056a9 | ||
![]() |
46e4433e1c | ||
![]() |
f9feb4e8e4 | ||
![]() |
d31e353d0d | ||
![]() |
4340472873 | ||
![]() |
9cf88c8d38 | ||
![]() |
fc3dce6600 | ||
![]() |
b78417b4de | ||
![]() |
b62006228f | ||
![]() |
1fbea88e58 | ||
![]() |
2d86894d9f | ||
![]() |
ad60711ee3 | ||
![]() |
889de794c3 | ||
![]() |
920d3f3327 | ||
![]() |
f6c34e9120 | ||
![]() |
81675930eb | ||
![]() |
ec594410e4 | ||
![]() |
8c6c03a9a2 | ||
![]() |
b82e85585c | ||
![]() |
b0f301843b | ||
![]() |
c3b3f0fc4f | ||
![]() |
8ba1f7f1d0 | ||
![]() |
19457573ed | ||
![]() |
218c85c89e | ||
![]() |
4968fac2a9 | ||
![]() |
30eb3e9e5c | ||
![]() |
27f543a20d | ||
![]() |
d73fcf27db | ||
![]() |
0a5c2e1598 | ||
![]() |
ab9345b6a8 | ||
![]() |
cd9af5da87 | ||
![]() |
398a792245 | ||
![]() |
81b1fb2d0c | ||
![]() |
ddcce77dc1 | ||
![]() |
d9c4cdb2f1 | ||
![]() |
46deba2c14 | ||
![]() |
5319c1c031 | ||
![]() |
40fb0b70ec | ||
![]() |
149208300d | ||
![]() |
114e49f4bb | ||
![]() |
bf131da26e | ||
![]() |
ea46a5c0c2 | ||
![]() |
e20815b84c | ||
![]() |
2d4a1cfef1 | ||
![]() |
02b9b5cbf3 | ||
![]() |
1679c0dcc4 | ||
![]() |
1bf113a960 | ||
![]() |
5623f87607 | ||
![]() |
96e6c2a730 | ||
![]() |
b26a9dfcf9 | ||
![]() |
37e6a84ba5 | ||
![]() |
538064589d | ||
![]() |
54265dab29 | ||
![]() |
91de331184 | ||
![]() |
979c2fae29 | ||
![]() |
4422bf6286 | ||
![]() |
3b075847b0 | ||
![]() |
616d08c1f9 | ||
![]() |
c640dc5d9e | ||
![]() |
099b88b3b1 | ||
![]() |
d94b14ae53 | ||
![]() |
41379627b5 | ||
![]() |
60b1d0224c | ||
![]() |
7d9712c209 | ||
![]() |
74b7c9da2c | ||
![]() |
260290f011 | ||
![]() |
dad766177f | ||
![]() |
55ad2438ed | ||
![]() |
1ebac1a450 | ||
![]() |
fed57014af | ||
![]() |
9f4945bad8 | ||
![]() |
4cbafc5f56 | ||
![]() |
c1b465069d | ||
![]() |
9f9d71e050 | ||
![]() |
f9977c7f84 | ||
![]() |
efe0a81787 | ||
![]() |
cfe81eef82 | ||
![]() |
06a282e890 | ||
![]() |
4da8cdd3b2 | ||
![]() |
9e52a97795 | ||
![]() |
bfd05f74d7 | ||
![]() |
76bf8cf09b | ||
![]() |
d35a1fdbb2 | ||
![]() |
44409a92f2 | ||
![]() |
835ed51da6 | ||
![]() |
12273eae1d | ||
![]() |
414adb5a71 | ||
![]() |
daf7b8b941 | ||
![]() |
307b04dfdd | ||
![]() |
8116d69b6c | ||
![]() |
5c38c91aee | ||
![]() |
3d951ba44c | ||
![]() |
fce8d79c4d | ||
![]() |
be6aa1e878 | ||
![]() |
e52b34c62d | ||
![]() |
8e2a1d58c1 | ||
![]() |
853fc5cf1a | ||
![]() |
bf000b70a1 | ||
![]() |
374d1908fc | ||
![]() |
210278703d | ||
![]() |
f6a47167c5 | ||
![]() |
e4a3cf00f0 | ||
![]() |
443208468e | ||
![]() |
a7d64fd132 | ||
![]() |
39b2182a00 | ||
![]() |
72d6e0596b | ||
![]() |
e214076620 | ||
![]() |
2ffefc8392 | ||
![]() |
f5cada0be8 | ||
![]() |
2c0052edc4 | ||
![]() |
4d7dc4e5ac | ||
![]() |
5d4e84241a | ||
![]() |
a7cd43fcd9 | ||
![]() |
2a85c9ebd4 | ||
![]() |
9da6f45269 | ||
![]() |
9a5497e318 | ||
![]() |
29761c6b10 | ||
![]() |
7198e1e618 | ||
![]() |
154fdaaad9 | ||
![]() |
e59f5dbb8f | ||
![]() |
e986de7f6c | ||
![]() |
6cfadd7f7c | ||
![]() |
ed70b3c611 | ||
![]() |
ed5d03044b | ||
![]() |
b179271e3c | ||
![]() |
cadd2c3fa0 | ||
![]() |
1281ecf869 | ||
![]() |
209330be6d | ||
![]() |
08aac8a995 | ||
![]() |
3b6a1762d6 | ||
![]() |
5e2df3821c | ||
![]() |
371a996624 | ||
![]() |
d8710d5b06 | ||
![]() |
3b33127dd9 | ||
![]() |
dd4076f49c | ||
![]() |
4c63f6b8fc | ||
![]() |
7a52a6122a | ||
![]() |
4928148eed | ||
![]() |
83513bf624 | ||
![]() |
1e156ec82b | ||
![]() |
e67f6b0392 | ||
![]() |
fa6c8a8fa1 | ||
![]() |
fb411e89f4 | ||
![]() |
62e6bdf43c | ||
![]() |
4d42624765 | ||
![]() |
f885616537 | ||
![]() |
900017bb3f | ||
![]() |
b7cff82ab2 | ||
![]() |
6b98b6116b | ||
![]() |
cca29e6695 | ||
![]() |
b4cb027a8e | ||
![]() |
e1b8d5cb33 | ||
![]() |
672e057f83 | ||
![]() |
7a4b1907b1 | ||
![]() |
302da09248 | ||
![]() |
008248ee0f | ||
![]() |
5753f0b869 | ||
![]() |
08672d6f2c | ||
![]() |
4675599b08 | ||
![]() |
beeb30f039 | ||
![]() |
eab541b7b8 | ||
![]() |
f4b667fef6 | ||
![]() |
e6ebde3ac4 | ||
![]() |
aff559780b | ||
![]() |
63caf91ec1 | ||
![]() |
beb2b2d3bd | ||
![]() |
fb5cd0ecdb | ||
![]() |
62141629c7 | ||
![]() |
726319efb6 | ||
![]() |
f742a01430 | ||
![]() |
428db939ab | ||
![]() |
019bce3590 | ||
![]() |
738bc88be2 | ||
![]() |
816f452646 | ||
![]() |
f6265bd387 | ||
![]() |
9c25621f12 | ||
![]() |
074deb4ce6 | ||
![]() |
b1428a53bd | ||
![]() |
54cc0e4735 | ||
![]() |
9fc75afdf0 | ||
![]() |
aae808e36b | ||
![]() |
41346e318b | ||
![]() |
98a910c6f1 | ||
![]() |
49a5f49966 | ||
![]() |
c153f719fe | ||
![]() |
83fd1f3224 | ||
![]() |
86581a7172 | ||
![]() |
18b3d36e03 | ||
![]() |
2c8307b3d8 | ||
![]() |
83fce5d8a1 | ||
![]() |
2f3fe82593 | ||
![]() |
907657725d | ||
![]() |
dac42e062c | ||
![]() |
ae1da4c3e8 | ||
![]() |
78b013dc0f | ||
![]() |
2d66e6f5d7 | ||
![]() |
9440527f17 | ||
![]() |
6e731866be | ||
![]() |
d0681bd907 | ||
![]() |
36981cd40f | ||
![]() |
18433fa3e0 | ||
![]() |
466921de44 | ||
![]() |
b395ab2cf9 | ||
![]() |
3bc6e106d2 | ||
![]() |
f64878861e | ||
![]() |
abf8dd3ea1 | ||
![]() |
f5b62f3a59 | ||
![]() |
502993946b | ||
![]() |
320ddc0e28 | ||
![]() |
97826c00bc | ||
![]() |
1335bbfcd5 | ||
![]() |
44074ff1a3 | ||
![]() |
54344acf4b | ||
![]() |
fe58a2b522 | ||
![]() |
4d95c17e86 | ||
![]() |
2f4ee35561 | ||
![]() |
10076be909 | ||
![]() |
7ab2f16f35 | ||
![]() |
7a1ed8f9a2 | ||
![]() |
744c1784c3 | ||
![]() |
7aabe17860 | ||
![]() |
bc324ec8ae | ||
![]() |
ff9c025126 | ||
![]() |
662a8aec69 | ||
![]() |
01ffb1a3e1 | ||
![]() |
4061075dde | ||
![]() |
dbf743afd9 | ||
![]() |
dd6fab86ee | ||
![]() |
344ec56da0 | ||
![]() |
672e8a9a24 | ||
![]() |
201ab3b13a | ||
![]() |
6fd288dcc1 | ||
![]() |
41eb84416a | ||
![]() |
e477cd8ee2 | ||
![]() |
4caa63e84f | ||
![]() |
3054667050 | ||
![]() |
b2102732cf | ||
![]() |
7141a75544 | ||
![]() |
926f7769c2 | ||
![]() |
538fadc908 | ||
![]() |
f605d96836 | ||
![]() |
0c1dd1cb7b | ||
![]() |
53f3d44f21 | ||
![]() |
faae7e32f4 | ||
![]() |
b8efd67e83 | ||
![]() |
7de45d154e | ||
![]() |
1353f62ebb | ||
![]() |
e22555b581 | ||
![]() |
55372aa530 | ||
![]() |
efa8a89f92 | ||
![]() |
0fba07e6e5 | ||
![]() |
23f82d3296 | ||
![]() |
bd7fd961d0 | ||
![]() |
1a8d365779 | ||
![]() |
335ae78a67 | ||
![]() |
bdf5a18b4d | ||
![]() |
71369c4c78 | ||
![]() |
1d62c2640e | ||
![]() |
d79add2ddb | ||
![]() |
f15c8a18d0 | ||
![]() |
879f0d8648 | ||
![]() |
20ac0d5066 | ||
![]() |
fb7f2b5a8e | ||
![]() |
4a3218dae3 | ||
![]() |
21f7a029fa | ||
![]() |
f8b4f700e7 | ||
![]() |
d2aee8fc37 | ||
![]() |
2144f2484b | ||
![]() |
83de5da08a | ||
![]() |
108db77a9d | ||
![]() |
385f218e7b | ||
![]() |
f224acb4e2 | ||
![]() |
0d84257ac0 | ||
![]() |
b4886fa135 | ||
![]() |
16a09cd959 | ||
![]() |
97ce2fc819 | ||
![]() |
9a864e8bcb | ||
![]() |
ca34d3df70 | ||
![]() |
2c889a39b8 | ||
![]() |
7047968cfc | ||
![]() |
0b207c3bb5 | ||
![]() |
6f7efc9f32 | ||
![]() |
a88d51b60b | ||
![]() |
65557fab5e | ||
![]() |
09b5dd6ac9 | ||
![]() |
a1b5cbc12e | ||
![]() |
bd950af9cf | ||
![]() |
04befd6138 | ||
![]() |
0b53dfc89f | ||
![]() |
c39b60d448 | ||
![]() |
50481af19e | ||
![]() |
6c2e5849ef | ||
![]() |
9496ffc3e6 | ||
![]() |
ab92fd696c | ||
![]() |
7d4b84fda8 | ||
![]() |
a67b3efde2 | ||
![]() |
e546e665d8 | ||
![]() |
d1ae45de14 | ||
![]() |
8ad05dfd47 | ||
![]() |
09cae9f924 | ||
![]() |
bd8cfc7b57 | ||
![]() |
77f0e2c2f8 | ||
![]() |
57ff04853b | ||
![]() |
1eaaa6ce9a | ||
![]() |
1526847a18 | ||
![]() |
cc1d149ac8 | ||
![]() |
569604646d | ||
![]() |
6f47d1aeff | ||
![]() |
9d62edf295 | ||
![]() |
7f4d8c04c6 | ||
![]() |
79c6714bac | ||
![]() |
ecd7a6f8cb | ||
![]() |
4ed97dab55 | ||
![]() |
d4eeb7441d | ||
![]() |
c504e14ff5 | ||
![]() |
f78ce97f05 | ||
![]() |
c1f8e3efb5 | ||
![]() |
e4c7124d28 | ||
![]() |
6bb9ad0511 | ||
![]() |
8697cc44e4 | ||
![]() |
8e5a801ef9 | ||
![]() |
876ae4098c | ||
![]() |
9c916e0932 | ||
![]() |
14162f8bcb | ||
![]() |
9fa8149f68 | ||
![]() |
e3979c61e7 | ||
![]() |
1d817a8b69 | ||
![]() |
2cb070c83c | ||
![]() |
2a6a994da1 | ||
![]() |
706cffe209 | ||
![]() |
dde907f4bb | ||
![]() |
81143de09b | ||
![]() |
8fdac7f79e | ||
![]() |
7b819d116c | ||
![]() |
bda2df2192 | ||
![]() |
2cada8a75c | ||
![]() |
e0280ad8c4 | ||
![]() |
1234fb2dd1 | ||
![]() |
0538f97ada | ||
![]() |
61265a792f | ||
![]() |
2599c85047 | ||
![]() |
ab2201f94d | ||
![]() |
80a8f58611 | ||
![]() |
e53f651fbb | ||
![]() |
25fb7c1c97 | ||
![]() |
839aa52e86 | ||
![]() |
9ff55289ea | ||
![]() |
73293fbcd3 | ||
![]() |
a27c218802 | ||
![]() |
f8fc0efadc | ||
![]() |
618a5b2df3 | ||
![]() |
1146dca5f6 | ||
![]() |
f86e856ee6 | ||
![]() |
6d13d61227 | ||
![]() |
0de9825bf2 | ||
![]() |
3f0b234cc4 | ||
![]() |
8f04ea8eee | ||
![]() |
7dcafa3fe0 | ||
![]() |
bead2183b2 | ||
![]() |
59dda09cd4 | ||
![]() |
d0b115751f | ||
![]() |
c6787aae3f | ||
![]() |
9025416ab3 | ||
![]() |
aa28257754 | ||
![]() |
d807e06fa0 | ||
![]() |
611d556936 | ||
![]() |
4313002950 | ||
![]() |
de11a60b17 | ||
![]() |
5064b269e7 | ||
![]() |
d8d9975756 | ||
![]() |
eee671cdc3 | ||
![]() |
587c063aba | ||
![]() |
28514e956d | ||
![]() |
42aeb8fa35 | ||
![]() |
f6f50a582e | ||
![]() |
f86818867b | ||
![]() |
82d962a54b | ||
![]() |
1b189043e4 | ||
![]() |
a4867566d9 | ||
![]() |
0757db69b2 | ||
![]() |
f0de25c992 | ||
![]() |
660549b08b | ||
![]() |
7807730118 | ||
![]() |
b526db0860 | ||
![]() |
0133324ded | ||
![]() |
e9ab0cd40b | ||
![]() |
9251ec496b | ||
![]() |
bd4cd02b2b | ||
![]() |
74ccfece5d | ||
![]() |
c89e499f96 | ||
![]() |
89e3582dd7 | ||
![]() |
48c013709a | ||
![]() |
f90f0a2e61 | ||
![]() |
c58b585855 | ||
![]() |
ded2e0f3d7 | ||
![]() |
21d5633233 | ||
![]() |
7703565c75 | ||
![]() |
5a9546ec0a | ||
![]() |
bc30a8bd82 | ||
![]() |
c432c2bd0d | ||
![]() |
364fbd350b | ||
![]() |
c64580f782 | ||
![]() |
e7dfdafd59 | ||
![]() |
b06ec9356d | ||
![]() |
3b1a66c93c | ||
![]() |
ed8a1811cc | ||
![]() |
dfbe2e080d | ||
![]() |
0fd9374e8c | ||
![]() |
1c8e48bee4 | ||
![]() |
3448335356 | ||
![]() |
4954473f50 | ||
![]() |
efa17caf5e | ||
![]() |
df165f0023 | ||
![]() |
0f583ece28 | ||
![]() |
d579977790 | ||
![]() |
8786c83db7 | ||
![]() |
1ce913e69d | ||
![]() |
48a8b74e7c | ||
![]() |
1ff13952b0 | ||
![]() |
02f7c4b291 | ||
![]() |
9da77637b2 | ||
![]() |
62f70250d5 | ||
![]() |
873c62e9ef | ||
![]() |
b1ff1e6277 | ||
![]() |
f644148844 | ||
![]() |
3120bbb77f | ||
![]() |
6cbe65c9d8 | ||
![]() |
1c908363cb | ||
![]() |
c01a15c930 | ||
![]() |
0c15aa55d8 | ||
![]() |
9f04e17e57 | ||
![]() |
308b50cbad | ||
![]() |
e44833b18a | ||
![]() |
0fa87f71a4 | ||
![]() |
edfbe2c3ed | ||
![]() |
70c7e93919 | ||
![]() |
95e466146d | ||
![]() |
efec212a9f | ||
![]() |
1844af0a41 | ||
![]() |
72b80d4984 | ||
![]() |
6dc5a68c80 | ||
![]() |
310b32c123 | ||
![]() |
748dd5e19f | ||
![]() |
c00d6f7bf8 | ||
![]() |
fc5d248094 | ||
![]() |
6f20ce5bba | ||
![]() |
edcc8741bf | ||
![]() |
3584151fab | ||
![]() |
efb6967e6a | ||
![]() |
eddbb1eee9 | ||
![]() |
6b40319723 | ||
![]() |
913e2892f7 | ||
![]() |
a3c5272e07 | ||
![]() |
55037f04cd | ||
![]() |
1fefb6e5b6 | ||
![]() |
3769176eaa | ||
![]() |
082650d458 | ||
![]() |
36004a7eba | ||
![]() |
81ef8ff9aa | ||
![]() |
da163903b1 | ||
![]() |
ccfa7a8d10 | ||
![]() |
b9394c2fa5 | ||
![]() |
1954c34628 | ||
![]() |
9f005a0a59 | ||
![]() |
bf0c562794 | ||
![]() |
54fe0c1ab9 | ||
![]() |
1bbc2eca24 | ||
![]() |
dcc1b74824 | ||
![]() |
8eb6b2378a | ||
![]() |
40415f34a4 | ||
![]() |
be4752ee0c | ||
![]() |
30e2295af4 | ||
![]() |
285f83e2fa | ||
![]() |
8db37617d4 | ||
![]() |
172883a499 | ||
![]() |
2a59543836 | ||
![]() |
77b917a921 | ||
![]() |
af8a6e6809 | ||
![]() |
6d8b33a58a | ||
![]() |
7322711609 | ||
![]() |
b8e8693342 | ||
![]() |
f0bc78ba2c | ||
![]() |
cadf1b4a7c | ||
![]() |
f79d84ad6e | ||
![]() |
b0125eb3fc | ||
![]() |
77175416a6 | ||
![]() |
7836edd10a | ||
![]() |
0ae189207f | ||
![]() |
56d4967eb7 | ||
![]() |
0451ac98c9 | ||
![]() |
54e53889e5 | ||
![]() |
149963c304 | ||
![]() |
44f5ec1fa2 | ||
![]() |
6c5bb83ac3 | ||
![]() |
d8ea685803 | ||
![]() |
3fa1fc349c | ||
![]() |
3adf92ea56 | ||
![]() |
b016320eaf | ||
![]() |
77588c1890 | ||
![]() |
e43993770d | ||
![]() |
9070fa4053 | ||
![]() |
7f041c3ac8 | ||
![]() |
b7c22287d6 | ||
![]() |
07042b9f31 | ||
![]() |
c0bb6e293c | ||
![]() |
74138a9a58 | ||
![]() |
e63473a5f8 | ||
![]() |
24378e0be8 | ||
![]() |
5ce005b55a | ||
![]() |
3ae2d50bff | ||
![]() |
2b421f1039 | ||
![]() |
e0ddbc1da2 | ||
![]() |
ca3a818678 | ||
![]() |
9155c32ece | ||
![]() |
3dbdb99118 | ||
![]() |
c3d96d2811 | ||
![]() |
429d1d7ce8 | ||
![]() |
5503ecbea2 | ||
![]() |
21376e013a | ||
![]() |
17f6d93c7c | ||
![]() |
0e701afb98 | ||
![]() |
cdcc89518a | ||
![]() |
1f6a7186f8 | ||
![]() |
ad1461bd2d | ||
![]() |
7ba9b05d12 | ||
![]() |
9c39eed209 | ||
![]() |
7ed95e317f | ||
![]() |
46105c86c6 | ||
![]() |
7785f4fe06 | ||
![]() |
585d8c6f0b | ||
![]() |
1f752e65ed | ||
![]() |
7595162a0e | ||
![]() |
20c30e92a3 | ||
![]() |
e00e4074e1 | ||
![]() |
7ec76ffed9 | ||
![]() |
c41b427c2e | ||
![]() |
c55545612e | ||
![]() |
dab0502319 | ||
![]() |
10bd555926 | ||
![]() |
53dc1f37ca | ||
![]() |
68f92e07b7 | ||
![]() |
957f0d3b17 | ||
![]() |
0bd1209bee | ||
![]() |
00c4a369cc | ||
![]() |
8a5ddb7c87 | ||
![]() |
90878f97b5 | ||
![]() |
09189378e0 | ||
![]() |
769968c2e8 | ||
![]() |
5d09e7d2ab | ||
![]() |
0924c9d9be | ||
![]() |
293534fb8b | ||
![]() |
5fceb70971 | ||
![]() |
d825a71d1f | ||
![]() |
a47071d341 | ||
![]() |
52c947f9e5 | ||
![]() |
07b7f38386 | ||
![]() |
291f99cbea | ||
![]() |
1fe598f554 | ||
![]() |
e9f274f304 | ||
![]() |
ca0afe585d | ||
![]() |
1a0e83365a | ||
![]() |
77a3bd833d | ||
![]() |
02abe2d920 | ||
![]() |
c8d9c4b871 | ||
![]() |
fee811dd75 | ||
![]() |
1910a1d782 | ||
![]() |
c387702bb1 | ||
![]() |
e015adcf4e | ||
![]() |
12eaae6bbb | ||
![]() |
e199e02e79 | ||
![]() |
b42e77af24 | ||
![]() |
0343898146 | ||
![]() |
b5f2cea1dc | ||
![]() |
2a9f607049 | ||
![]() |
043883bd8e | ||
![]() |
ed5592260f | ||
![]() |
f4b0be8aed | ||
![]() |
b723d51786 | ||
![]() |
25d4325bd0 | ||
![]() |
319f9c4ece | ||
![]() |
06ef226440 | ||
![]() |
3691ec389a | ||
![]() |
ca2ca2bef4 | ||
![]() |
907d9999dc | ||
![]() |
e9c5de577e | ||
![]() |
87d6ed39eb | ||
![]() |
cf20ac29db | ||
![]() |
1a96f87da0 | ||
![]() |
0f825a6efb | ||
![]() |
1b8d72105d | ||
![]() |
5ef2996b40 | ||
![]() |
1ac3164d0c | ||
![]() |
e4725d433e | ||
![]() |
3716e3af6e | ||
![]() |
366f3e07df | ||
![]() |
6801ea6c2d | ||
![]() |
4b37d19f65 | ||
![]() |
c1bca79c50 | ||
![]() |
ee88c111f2 | ||
![]() |
067550720a | ||
![]() |
c5b1b32f2c | ||
![]() |
bd7436e5d2 | ||
![]() |
8b883dc957 | ||
![]() |
06808da616 | ||
![]() |
0b900128c1 | ||
![]() |
b74eec6a03 | ||
![]() |
92d0f18389 | ||
![]() |
c0f936f8fe | ||
![]() |
7e492422fe | ||
![]() |
4325bca22b | ||
![]() |
5a765187ab | ||
![]() |
e9a02ca337 | ||
![]() |
221a6f2fc3 | ||
![]() |
2267db11c6 | ||
![]() |
a4d34323ed | ||
![]() |
91db9b03a8 | ||
![]() |
0be47261c7 | ||
![]() |
49b39b7fa8 | ||
![]() |
1f37e3ab8b | ||
![]() |
e183c62036 | ||
![]() |
370c8dd58e | ||
![]() |
b19f73c870 | ||
![]() |
dccdcbbbe2 | ||
![]() |
280911b233 | ||
![]() |
f3d17d3be2 | ||
![]() |
3f6cc16850 | ||
![]() |
4ebc8b6798 | ||
![]() |
7079564ffe | ||
![]() |
991034115b | ||
![]() |
57814915d6 | ||
![]() |
8181738d48 | ||
![]() |
0a8cc317a9 | ||
![]() |
8df73b13bd | ||
![]() |
d975c6fc2c | ||
![]() |
67d5d5c00a | ||
![]() |
603e10b6ca | ||
![]() |
9ae0d9b744 | ||
![]() |
28f9540113 | ||
![]() |
468a17ad58 | ||
![]() |
b84a6ccc32 | ||
![]() |
a45b7173e5 | ||
![]() |
d23f1d39eb | ||
![]() |
e6172ad38b | ||
![]() |
5870e8d6e6 | ||
![]() |
3d696646c5 | ||
![]() |
6edb6ccb15 | ||
![]() |
6cb7fca3ab | ||
![]() |
3375563e64 | ||
![]() |
832ee35a93 | ||
![]() |
550540fad0 | ||
![]() |
e59c2af818 | ||
![]() |
ee6ee30df1 | ||
![]() |
675f5184a0 | ||
![]() |
0a9f2d99d5 | ||
![]() |
35dcf91a06 | ||
![]() |
7876727a41 | ||
![]() |
3c3fad808d | ||
![]() |
357fac4d49 | ||
![]() |
f45f51d44b | ||
![]() |
5bbbf14c92 | ||
![]() |
0a933614fa | ||
![]() |
22a1388d50 | ||
![]() |
0719ad0afd | ||
![]() |
1671dfb617 | ||
![]() |
b730fab643 | ||
![]() |
81e1383da5 | ||
![]() |
cdc43775a6 | ||
![]() |
2a57c64fa0 | ||
![]() |
8a86282951 | ||
![]() |
da31709677 | ||
![]() |
b14a8e63c6 | ||
![]() |
cc89692d80 | ||
![]() |
5782c326b2 | ||
![]() |
af444391b5 | ||
![]() |
9bc44f44a0 | ||
![]() |
f7f4167b06 | ||
![]() |
8fa9c40e86 | ||
![]() |
31a4924186 | ||
![]() |
a6b9d4a82b | ||
![]() |
ca897bdd2f | ||
![]() |
fa44850686 | ||
![]() |
a6e4da8c41 | ||
![]() |
895c1ecd8d | ||
![]() |
ae35f9d11d | ||
![]() |
2506c02c39 | ||
![]() |
a08d9d147c | ||
![]() |
cb109b49b8 | ||
![]() |
d51303cb8b | ||
![]() |
c00354c833 | ||
![]() |
1ee0ec68c5 | ||
![]() |
5c1411b3de | ||
![]() |
2d8ec4ab89 | ||
![]() |
c7e20296a2 | ||
![]() |
a98ca69382 | ||
![]() |
886fc89df6 | ||
![]() |
112502155e | ||
![]() |
be446f5433 | ||
![]() |
a9f5e4b5e7 | ||
![]() |
78b8b441ba | ||
![]() |
d52755a153 | ||
![]() |
d5856b83c6 | ||
![]() |
338e203b6f | ||
![]() |
026ef988c4 | ||
![]() |
5f2dca1979 | ||
![]() |
676470bae2 | ||
![]() |
e0525e5f55 | ||
![]() |
d4ce90a7e8 | ||
![]() |
171f0ec857 | ||
![]() |
fbf49368c1 | ||
![]() |
3f8d68c7f7 | ||
![]() |
0c6260367e | ||
![]() |
0b5797249f | ||
![]() |
e453a316f7 | ||
![]() |
25a5d3fe7b | ||
![]() |
34aca66fef | ||
![]() |
5ea09d323f | ||
![]() |
4541486d0d | ||
![]() |
a94fe1c9d0 | ||
![]() |
58f3ff6cd6 | ||
![]() |
fbc779d174 | ||
![]() |
7c1873c4e3 | ||
![]() |
123cf13145 | ||
![]() |
58053d0b53 | ||
![]() |
68d0d55532 | ||
![]() |
b6304ab18c | ||
![]() |
e996e53a64 | ||
![]() |
f15150c40d | ||
![]() |
01486c2aef | ||
![]() |
5ad32c9e26 | ||
![]() |
2b1a5072d7 | ||
![]() |
c6c4d52556 | ||
![]() |
d601a117c0 | ||
![]() |
0767df3f78 | ||
![]() |
670a4ef632 | ||
![]() |
0633c09726 | ||
![]() |
d535ae6ee1 | ||
![]() |
209013af09 | ||
![]() |
dfa0e5f300 | ||
![]() |
897968027c | ||
![]() |
ad0725e9ae | ||
![]() |
4a167c5bf5 | ||
![]() |
4c0c6f1325 | ||
![]() |
dff36d5c43 | ||
![]() |
a50f97e5f3 | ||
![]() |
9c9a1f7c35 | ||
![]() |
e251a8a50b | ||
![]() |
dfb5a665f0 | ||
![]() |
22556984fa | ||
![]() |
1fda33848e | ||
![]() |
d9add9f670 | ||
![]() |
49ee431676 | ||
![]() |
0092c8cbe9 | ||
![]() |
d0a4c51ef5 | ||
![]() |
52b2d12bf9 | ||
![]() |
5e5fb0e287 | ||
![]() |
886488a3c9 | ||
![]() |
69f9004917 | ||
![]() |
f635e0a634 | ||
![]() |
29f6a73de1 | ||
![]() |
f28c90498b | ||
![]() |
66484bac80 | ||
![]() |
99077da1bf | ||
![]() |
fc97e8ff5b | ||
![]() |
9d3c7ef116 | ||
![]() |
e9740fe693 | ||
![]() |
1fbd88c826 | ||
![]() |
d3cdadd444 | ||
![]() |
582a9847a1 | ||
![]() |
126cd4d535 | ||
![]() |
c9265028d2 | ||
![]() |
77717c960c | ||
![]() |
454ad18f1b | ||
![]() |
4be5d81f17 | ||
![]() |
5ffb96baf6 | ||
![]() |
1487932c1d | ||
![]() |
d9e7a09d24 | ||
![]() |
a3116e703a | ||
![]() |
8dd29039cd | ||
![]() |
0034b22da4 | ||
![]() |
eebe57840b | ||
![]() |
d59cdb0aa4 | ||
![]() |
16561845f8 | ||
![]() |
e9de11000b | ||
![]() |
c6c844f3fd | ||
![]() |
fb61891c29 | ||
![]() |
94323c8fe1 | ||
![]() |
f1f5a96929 | ||
![]() |
df0c30c2f2 | ||
![]() |
68f2c3fc5b | ||
![]() |
d0ede35e89 |
549 changed files with 40515 additions and 19154 deletions
|
@ -11,7 +11,6 @@ dist
|
||||||
.netlify/
|
.netlify/
|
||||||
.eslintcache
|
.eslintcache
|
||||||
|
|
||||||
public/shiki
|
|
||||||
public/emojis
|
public/emojis
|
||||||
|
|
||||||
*~
|
*~
|
||||||
|
|
|
@ -8,7 +8,7 @@ NUXT_CLOUDFLARE_ACCOUNT_ID=
|
||||||
NUXT_CLOUDFLARE_NAMESPACE_ID=
|
NUXT_CLOUDFLARE_NAMESPACE_ID=
|
||||||
NUXT_CLOUDFLARE_API_TOKEN=
|
NUXT_CLOUDFLARE_API_TOKEN=
|
||||||
|
|
||||||
# 'cloudflare' | 'fs'
|
# 'cloudflare' | 'vercel' | 'fs'
|
||||||
NUXT_STORAGE_DRIVER=
|
NUXT_STORAGE_DRIVER=
|
||||||
NUXT_STORAGE_FS_BASE=
|
NUXT_STORAGE_FS_BASE=
|
||||||
|
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
*.css
|
|
||||||
*.png
|
|
||||||
*.ico
|
|
||||||
*.toml
|
|
||||||
*.patch
|
|
||||||
*.txt
|
|
||||||
Dockerfile
|
|
||||||
public/
|
|
||||||
https-dev-config/localhost.crt
|
|
||||||
https-dev-config/localhost.key
|
|
||||||
Dockerfile
|
|
||||||
elk-translation-status.json
|
|
||||||
docs/translation-status.json
|
|
18
.eslintrc
18
.eslintrc
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "@antfu",
|
|
||||||
"ignorePatterns": ["!pages/public"],
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": ["locales/**.json"],
|
|
||||||
"rules": {
|
|
||||||
"jsonc/sort-keys": "error"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"vue/no-restricted-syntax":["error", {
|
|
||||||
"selector": "VElement[name='a']",
|
|
||||||
"message": "Use NuxtLink instead."
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
}
|
|
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
* text=auto eol=lf
|
12
.github/renovate.json5
vendored
12
.github/renovate.json5
vendored
|
@ -3,10 +3,13 @@
|
||||||
"extends": ["config:base", "schedule:weekly", "group:allNonMajor"],
|
"extends": ["config:base", "schedule:weekly", "group:allNonMajor"],
|
||||||
"labels": ["c: dependencies"],
|
"labels": ["c: dependencies"],
|
||||||
"rangeStrategy": "bump",
|
"rangeStrategy": "bump",
|
||||||
"node": false,
|
|
||||||
"ignoreDeps": [
|
"ignoreDeps": [
|
||||||
"vue",
|
"vue",
|
||||||
"vue-tsc"
|
"vue-tsc",
|
||||||
|
"typescript",
|
||||||
|
|
||||||
|
// Intl.Segmenter is not supported in Firefox
|
||||||
|
"string-length"
|
||||||
],
|
],
|
||||||
"packageRules": [
|
"packageRules": [
|
||||||
{
|
{
|
||||||
|
@ -37,7 +40,6 @@
|
||||||
"groupName": "lint",
|
"groupName": "lint",
|
||||||
"matchPackageNames": [
|
"matchPackageNames": [
|
||||||
"@antfu/eslint-config",
|
"@antfu/eslint-config",
|
||||||
"@types/prettier",
|
|
||||||
"eslint",
|
"eslint",
|
||||||
"prettier"
|
"prettier"
|
||||||
]
|
]
|
||||||
|
@ -61,6 +63,10 @@
|
||||||
{
|
{
|
||||||
"groupName": "typescript",
|
"groupName": "typescript",
|
||||||
"matchPackageNames": ["typescript"]
|
"matchPackageNames": ["typescript"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"matchDatasources": ["node-version"],
|
||||||
|
"enabled": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"vulnerabilityAlerts": {
|
"vulnerabilityAlerts": {
|
||||||
|
|
16
.github/workflows/ci.yml
vendored
16
.github/workflows/ci.yml
vendored
|
@ -10,18 +10,21 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
workflow_dispatch: {}
|
workflow_dispatch: {}
|
||||||
|
merge_group: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- run: corepack enable
|
# workaround for npm registry key change
|
||||||
- uses: actions/setup-node@v3
|
# ref. `pnpm@10.1.0` / `pnpm@9.15.4` cannot be installed due to key id mismatch · Issue #612 · nodejs/corepack
|
||||||
|
# - https://github.com/nodejs/corepack/issues/612#issuecomment-2629496091
|
||||||
|
- run: npm i -g corepack@latest && corepack enable
|
||||||
|
- uses: actions/setup-node@v4.4.0
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version-file: .nvmrc
|
||||||
cache: pnpm
|
|
||||||
|
|
||||||
- name: 📦 Install dependencies
|
- name: 📦 Install dependencies
|
||||||
run: pnpm install --frozen-lockfile
|
run: pnpm install --frozen-lockfile
|
||||||
|
@ -30,7 +33,8 @@ jobs:
|
||||||
run: pnpm nuxi prepare
|
run: pnpm nuxi prepare
|
||||||
|
|
||||||
- name: 🧪 Test project
|
- name: 🧪 Test project
|
||||||
run: pnpm test tests/unit
|
run: pnpm test:ci
|
||||||
|
timeout-minutes: 10
|
||||||
|
|
||||||
- name: 📝 Lint
|
- name: 📝 Lint
|
||||||
run: pnpm lint
|
run: pnpm lint
|
||||||
|
|
20
.github/workflows/docker.yml
vendored
20
.github/workflows/docker.yml
vendored
|
@ -16,29 +16,29 @@ jobs:
|
||||||
packages: write
|
packages: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: metal
|
id: metal
|
||||||
uses: docker/metadata-action@v4
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
ghcr.io/elk-zone/elk
|
ghcr.io/${{ github.repository }}
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v3
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v3
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ github.token }}
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.metal.outputs.tags }}
|
tags: ${{ steps.metal.outputs.tags }}
|
||||||
labels: ${{ steps.metal.outputs.labels }}
|
labels: ${{ steps.metal.outputs.labels }}
|
||||||
|
|
6
.github/workflows/release.yml
vendored
6
.github/workflows/release.yml
vendored
|
@ -12,14 +12,14 @@ jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set node
|
- name: Set node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version-file: .nvmrc
|
||||||
|
|
||||||
- run: npx changelogithub
|
- run: npx changelogithub
|
||||||
env:
|
env:
|
||||||
|
|
2
.github/workflows/semantic-pull-request.yml
vendored
2
.github/workflows/semantic-pull-request.yml
vendored
|
@ -19,6 +19,6 @@ jobs:
|
||||||
name: Semantic Pull Request
|
name: Semantic Pull Request
|
||||||
steps:
|
steps:
|
||||||
- name: Validate PR title
|
- name: Validate PR title
|
||||||
uses: amannn/action-semantic-pull-request@v5.2.0
|
uses: amannn/action-semantic-pull-request@v5.5.3
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -2,6 +2,7 @@ node_modules
|
||||||
*.log
|
*.log
|
||||||
dist
|
dist
|
||||||
.output
|
.output
|
||||||
|
.pnpm-store
|
||||||
.nuxt
|
.nuxt
|
||||||
.env
|
.env
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
@ -11,7 +12,6 @@ dist
|
||||||
.eslintcache
|
.eslintcache
|
||||||
elk-translation-status.json
|
elk-translation-status.json
|
||||||
|
|
||||||
public/shiki
|
|
||||||
public/emojis
|
public/emojis
|
||||||
|
|
||||||
*~
|
*~
|
||||||
|
|
2
.npmrc
2
.npmrc
|
@ -1,4 +1,4 @@
|
||||||
shamefully-hoist=true
|
shamefully-hoist=true
|
||||||
strict-peer-dependencies=false
|
|
||||||
shell-emulator=true
|
shell-emulator=true
|
||||||
ignore-workspace-root-check=true
|
ignore-workspace-root-check=true
|
||||||
|
package-manager-strict=false
|
||||||
|
|
2
.nvmrc
2
.nvmrc
|
@ -1 +1 @@
|
||||||
v18
|
22
|
45
.vscode/settings.json
vendored
45
.vscode/settings.json
vendored
|
@ -5,10 +5,6 @@
|
||||||
"unmute",
|
"unmute",
|
||||||
"unstorage"
|
"unstorage"
|
||||||
],
|
],
|
||||||
"editor.codeActionsOnSave": {
|
|
||||||
"source.fixAll.eslint": true
|
|
||||||
},
|
|
||||||
"editor.formatOnSave": false,
|
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"*.css": "postcss"
|
"*.css": "postcss"
|
||||||
},
|
},
|
||||||
|
@ -23,7 +19,44 @@
|
||||||
"i18n-ally.preferredDelimiter": "_",
|
"i18n-ally.preferredDelimiter": "_",
|
||||||
"i18n-ally.sortKeys": true,
|
"i18n-ally.sortKeys": true,
|
||||||
"i18n-ally.sourceLanguage": "en",
|
"i18n-ally.sourceLanguage": "en",
|
||||||
|
|
||||||
|
// Enable the ESlint flat config support
|
||||||
|
"eslint.experimental.useFlatConfig": true,
|
||||||
|
|
||||||
|
// Disable the default formatter, use eslint instead
|
||||||
"prettier.enable": false,
|
"prettier.enable": false,
|
||||||
"volar.completion.preferredTagNameCase": "pascal",
|
"editor.formatOnSave": false,
|
||||||
"volar.completion.preferredAttrNameCase": "kebab"
|
|
||||||
|
// Auto fix
|
||||||
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.fixAll": "explicit",
|
||||||
|
"source.organizeImports": "never"
|
||||||
|
},
|
||||||
|
|
||||||
|
// Silent the stylistic rules in you IDE, but still auto fix them
|
||||||
|
"eslint.rules.customizations": [
|
||||||
|
{ "rule": "style/*", "severity": "off" },
|
||||||
|
{ "rule": "*-indent", "severity": "off" },
|
||||||
|
{ "rule": "*-spacing", "severity": "off" },
|
||||||
|
{ "rule": "*-spaces", "severity": "off" },
|
||||||
|
{ "rule": "*-order", "severity": "off" },
|
||||||
|
{ "rule": "*-dangle", "severity": "off" },
|
||||||
|
{ "rule": "*-newline", "severity": "off" },
|
||||||
|
{ "rule": "*quotes", "severity": "off" },
|
||||||
|
{ "rule": "*semi", "severity": "off" }
|
||||||
|
],
|
||||||
|
|
||||||
|
// Enable eslint for all supported languages
|
||||||
|
"eslint.validate": [
|
||||||
|
"javascript",
|
||||||
|
"javascriptreact",
|
||||||
|
"typescript",
|
||||||
|
"typescriptreact",
|
||||||
|
"vue",
|
||||||
|
"html",
|
||||||
|
"markdown",
|
||||||
|
"json",
|
||||||
|
"jsonc",
|
||||||
|
"yaml"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,23 +6,16 @@ Refer also to https://github.com/antfu/contribute.
|
||||||
|
|
||||||
For guidelines on contributing to the documentation, refer to the [docs README](./docs/README.md).
|
For guidelines on contributing to the documentation, refer to the [docs README](./docs/README.md).
|
||||||
|
|
||||||
### Online
|
|
||||||
|
|
||||||
You can use [StackBlitz Codeflow](https://stackblitz.com/codeflow) to fix bugs or implement features. You'll also see a Codeflow button on PRs to review them without a local setup. Once the elk repo has been cloned in Codeflow, the dev server will start automatically and print the URL to open the App. You should receive a prompt in the bottom-right suggesting to open it in the Editor or in another Tab. To learn more, check out the [Codeflow docs](https://developer.stackblitz.com/codeflow/what-is-codeflow).
|
|
||||||
|
|
||||||
[](https://pr.new/elk-zone/elk)
|
|
||||||
|
|
||||||
### Local Setup
|
### Local Setup
|
||||||
|
|
||||||
To develop and test the Elk package:
|
To develop and test the Elk package:
|
||||||
|
|
||||||
1. Fork the Elk repository to your own GitHub account and then clone it to your local device.
|
1. Fork the Elk repository to your own GitHub account and then clone it to your local device.
|
||||||
|
|
||||||
2. Ensure using the latest Node.js (16.x).
|
2. Ensure using the LTS version of Node.js.
|
||||||
If you have [nvm](https://github.com/nvm-sh/nvm), you can run `nvm i` to install the required version.
|
If you have [nvm](https://github.com/nvm-sh/nvm), you can run `nvm i` to install the required version.
|
||||||
|
|
||||||
|
3. The package manager used to install and link dependencies must be [pnpm](https://pnpm.io/) v9. To use it you must first enable [Corepack](https://github.com/nodejs/corepack) by running `corepack enable`. (Note: on Linux in a standard Node 20+ environment, you should follow the instructions to install via Node's `corepack` rather than using the `curl` command)
|
||||||
3. The package manager used to install and link dependencies must be [pnpm](https://pnpm.io/) v7. To use it you must first enable [Corepack](https://github.com/nodejs/corepack) by running `corepack enable`. (Note: on Linux in a standard Node 16+ environment, you should follow the instructions to install via Node's `corepack` rather than using the `curl` command)
|
|
||||||
|
|
||||||
4. Check out a branch where you can work and commit your changes:
|
4. Check out a branch where you can work and commit your changes:
|
||||||
```shell
|
```shell
|
||||||
|
@ -84,21 +77,21 @@ Simple approach used by most websites of relying on direction set in HTML elemen
|
||||||
We've added some `UnoCSS` utilities styles to help you with that:
|
We've added some `UnoCSS` utilities styles to help you with that:
|
||||||
- Do not use `left/right` padding and margin: for example `pl-1`. Use `padding-inline-start/end` instead. So `pl-1` should be `ps-1`, `pr-1` should be `pe-1`. The same rules apply to margin.
|
- Do not use `left/right` padding and margin: for example `pl-1`. Use `padding-inline-start/end` instead. So `pl-1` should be `ps-1`, `pr-1` should be `pe-1`. The same rules apply to margin.
|
||||||
- Do not use `rtl-` classes, such as `rtl-left-0`.
|
- Do not use `rtl-` classes, such as `rtl-left-0`.
|
||||||
- For icons that should be rotated for RTL, add `class="rtl-flip"`. This can only be used for icons outside of elements with `dir="auto"`, such as timeline, and is the only exception from the rule above. For icons inside the timeline, it might not work as expected.
|
- For icons that should be rotated for RTL, add `class="rtl-flip"`. This can only be used for icons outside of elements with `dir="auto"`, such as timeline, and is the only exception to the rule above. For icons inside the timeline, it might not work as expected.
|
||||||
- For absolute positioned elements, don't use `left/right`: for example `left-0`. Use `inset-inline-start/end` instead. `UnoCSS` shortcuts are `inset-is` for `inset-inline-start` and `inset-ie` for `inset-inline-end`. Example: `left-0` should be replaced with `inset-is-0`.
|
- For absolute positioned elements, don't use `left/right`: for example `left-0`. Use `inset-inline-start/end` instead. `UnoCSS` shortcuts are `inset-is` for `inset-inline-start` and `inset-ie` for `inset-inline-end`. Example: `left-0` should be replaced with `inset-is-0`.
|
||||||
- If you need to change the border radius for an entire left or right side, use `border-inline-start/end`. `UnoCSS` shortcuts are `rounded-is` for left side, `rounded-ie` for right side. Example: `rounded-l-5` should be replaced with `rounded-ie-5`.
|
- If you need to change the border radius for an entire left or right side, use `border-inline-start/end`. `UnoCSS` shortcuts are `rounded-is` for left side, `rounded-ie` for right side. Example: `rounded-l-5` should be replaced with `rounded-ie-5`.
|
||||||
- If you need to change the border radius for one corner, use `border-start-end-radius` and similar rules. `UnoCSS` shortcuts are `rounded` + top/bottom as either `-bs` (top) or `-be` (bottom) + left/right as either `-is` (left) or `-ie` (right). Example: `rounded-tl-0` should be replaced with `rounded-bs-is-0`.
|
- If you need to change the border radius for one corner, use `border-start-end-radius` and similar rules. `UnoCSS` shortcuts are `rounded` + top/bottom as either `-bs` (top) or `-be` (bottom) + left/right as either `-is` (left) or `-ie` (right). Example: `rounded-tl-0` should be replaced with `rounded-bs-is-0`.
|
||||||
|
|
||||||
## Internationalization
|
## Internationalization
|
||||||
|
|
||||||
We are using [vue-i18n](https://vue-i18n.intlify.dev/) via [nuxt-i18n](https://v8.i18n.nuxtjs.org/) to handle internationalization.
|
We are using [vue-i18n](https://vue-i18n.intlify.dev/) via [nuxt-i18n](https://i18n.nuxtjs.org/) to handle internationalization.
|
||||||
|
|
||||||
You can check the current [translation status](https://docs.elk.zone/docs/guide/contributing#translation-status): more instructions on the table caption.
|
You can check the current [translation status](https://docs.elk.zone/guide/contributing#translation-status): more instructions on the table caption.
|
||||||
|
|
||||||
If you are updating a translation in your local environment, you can run the following commands to check the status:
|
If you are updating a translation in your local environment, you can run the following commands to check the status:
|
||||||
- from root folder: `nr prepare-translation-status`
|
- from root folder: `nr prepare-translation-status`
|
||||||
- change to `docs` folder and run docs dev server `nr dev`
|
- change to `docs` folder and run docs dev server `nr dev`
|
||||||
- open `http://localhost:3000/docs/guide/contributing#translation-status` in your browser
|
- open `http://localhost:3000/guide/contributing#translation-status` in your browser
|
||||||
|
|
||||||
### Adding a new language
|
### Adding a new language
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,10 @@ WORKDIR /elk
|
||||||
FROM base AS builder
|
FROM base AS builder
|
||||||
|
|
||||||
# Prepare pnpm https://pnpm.io/installation#using-corepack
|
# Prepare pnpm https://pnpm.io/installation#using-corepack
|
||||||
RUN corepack enable
|
# workaround for npm registry key change
|
||||||
|
# ref. `pnpm@10.1.0` / `pnpm@9.15.4` cannot be installed due to key id mismatch · Issue #612 · nodejs/corepack
|
||||||
|
# - https://github.com/nodejs/corepack/issues/612#issuecomment-2629496091
|
||||||
|
RUN npm i -g corepack@latest && corepack enable
|
||||||
|
|
||||||
# Prepare deps
|
# Prepare deps
|
||||||
RUN apk update
|
RUN apk update
|
||||||
|
@ -14,6 +17,7 @@ RUN apk add git --no-cache
|
||||||
|
|
||||||
# Prepare build deps ( ignore postinstall scripts for now )
|
# Prepare build deps ( ignore postinstall scripts for now )
|
||||||
COPY package.json ./
|
COPY package.json ./
|
||||||
|
COPY .npmrc ./
|
||||||
COPY pnpm-lock.yaml ./
|
COPY pnpm-lock.yaml ./
|
||||||
COPY patches ./patches
|
COPY patches ./patches
|
||||||
RUN pnpm i --frozen-lockfile --ignore-scripts
|
RUN pnpm i --frozen-lockfile --ignore-scripts
|
||||||
|
|
91
README.md
91
README.md
|
@ -1,28 +1,16 @@
|
||||||
<p align="center">
|
# Yolk
|
||||||
<a href="https://elk.zone" target="_blank" rel="noopener noreferrer">
|
|
||||||
<img width="160" height="160" src="./public/logo.svg" alt="Elk logo">
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<h1 align="center"/>Elk <sup><em>alpha</em></sup></h1>
|
Hi! Yolk is my custom fork of [Elk](https://github.com/elk-zon/elk), a nimble Mastodon client.
|
||||||
|
|
||||||
<p align="center">
|
I [decided](https://social.ayco.io/@ayo/114921112446517000) to have a personal fork of Elk because I really like the cross-account functionalities I use it for (e.g., I can open the Explore tab of my fosstodon account, then engage in a post with my self-hosted account, etc)... but I find sometimes I want to change little things which will make the app a bit more opinionated on my tastes (e.g., icons, colors, spacing, etc)... and some behavioral features.
|
||||||
A nimble Mastodon web client
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<br/>
|
I think doing this will make me use it as my main app daily. I have been switching between multiple apps because each one have strengths & weaknesses of their own.
|
||||||
<p align="center">
|
|
||||||
<a href="https://chat.elk.zone"><img src="https://img.shields.io/badge/chat-discord-blue?style=flat&logo=discord" alt="discord chat"></a>
|
|
||||||
<a href="https://pr.new/elk-zone/elk"><img src="https://developer.stackblitz.com/img/start_pr_dark_small.svg" alt="Start new PR in StackBlitz Codeflow"></a>
|
|
||||||
<a href="https://volta.net/elk-zone/elk?utm_source=elk_readme"><img src="https://user-images.githubusercontent.com/904724/209143798-32345f6c-3cf8-4e06-9659-f4ace4a6acde.svg" alt="Open board on Volta"></a>
|
|
||||||
</p>
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
<p align="center">
|
Crucial fixes (if I find them), quality of life improvements, and mastodon API feature parity will still go upstream to the main Elk project.
|
||||||
<a href="https://elk.zone/" target="_blank" rel="noopener noreferrer" >
|
|
||||||
<img src="./public/elk-og.png" alt="Elk screenshots" width="600" height="auto">
|
~ Ayo Ayco
|
||||||
</a>
|
|
||||||
</p>
|
---
|
||||||
|
|
||||||
## ⚠️ Elk is in Alpha
|
## ⚠️ Elk is in Alpha
|
||||||
|
|
||||||
|
@ -39,73 +27,24 @@ The Elk team maintains a deployment at:
|
||||||
|
|
||||||
### Self-Host Docker Deployment
|
### Self-Host Docker Deployment
|
||||||
|
|
||||||
In order to host Elk yourself you can use the provided Dockerfile to build a container with elk. Be aware, that Elk only loads properly of the connection is done via SSL/TLS. The Docker container itself does not provide any SSL/TLS handling. You'll have to add this bit yourself.
|
In order to host Elk yourself you can use the provided Dockerfile to build a container with elk. Be aware, that Elk only loads properly if the connection is done via SSL/TLS. The Docker container itself does not provide any SSL/TLS handling. You'll have to add this bit yourself.
|
||||||
One could put Elk behind popular reverse proxies with SSL Handling like Traefik, NGINX etc.
|
One could put Elk behind popular reverse proxies with SSL Handling like Traefik, NGINX etc.
|
||||||
|
|
||||||
1. checkout source ```git clone https://github.com/elk-zone/elk.git```
|
1. checkout source ```git clone https://github.com/elk-zone/elk.git```
|
||||||
1. got into new source dir: ```cd elk```
|
1. got into new source dir: ```cd elk```
|
||||||
1. build Docker image: ```docker build .```
|
|
||||||
1. create local storage directory for settings: ```mkdir elk-storage```
|
1. create local storage directory for settings: ```mkdir elk-storage```
|
||||||
1. adjust permissions of storage dir: ```sudo chown 911:911 ./elk-storage```
|
1. adjust permissions of storage dir: ```sudo chown 911:911 ./elk-storage```
|
||||||
1. start container: ```docker-compose up -d```
|
1. start container: ```docker-compose up --build -d```
|
||||||
|
|
||||||
Note: The provided Dockerfile creates a container which will eventually run Elk as non-root user and create a persistent named Docker volume upon first start (if that volume does not yet exist). This volume is always created with root permission. Failing to change the permissions of ```/elk/data``` inside this volume to UID:GID 911 (as specified for Elk in the Dockerfile) will prevent Elk from storing it's config for user accounts. You either have to fix the permission in the created named volume, or mount a directory with the correct permission to ```/elk/data``` into the container.
|
> [!NOTE]
|
||||||
|
> The provided Dockerfile creates a container which will eventually run Elk as non-root user and create a persistent named Docker volume upon first start (if that volume does not yet exist). This volume is always created with root permission. Failing to change the permissions of ```/elk/data``` inside this volume to UID:GID 911 (as specified for Elk in the Dockerfile) will prevent Elk from storing it's config for user accounts. You either have to fix the permission in the created named volume, or mount a directory with the correct permission to ```/elk/data``` into the container.
|
||||||
|
|
||||||
### Ecosystem
|
|
||||||
|
|
||||||
These are known deployments using Elk as an alternative Web client for Mastodon servers or as a base for other projects in the fediverse:
|
|
||||||
|
|
||||||
- [elk.fedified.com](https://elk.fedified.com) - Use Elk to log into any compatible instance
|
|
||||||
- [elk.h4.io](https://elk.h4.io) - Use Elk for the `h4.io` Server
|
|
||||||
- [elk.universeodon.com](https://elk.universeodon.com) - Use Elk for the Universeodon Server
|
|
||||||
- [elk.vmst.io](https://elk.vmst.io) - Use Elk for the `vmst.io` Server
|
|
||||||
- [elk.hostux.social](https://elk.hostux.social) - Use Elk for the `hostux.social` Server
|
|
||||||
- [elk.cupoftea.social](https://elk.cupoftea.social) - Use Elk for the `cupoftea.social` Server
|
|
||||||
- [elk.aus.social](https://elk.aus.social) - Use Elk for the `aus.social` Server
|
|
||||||
|
|
||||||
> **Note**: Community deployments are **NOT** maintained by the Elk team. It may not be synced with Elk's source code. Please do your own research about the host servers before using them.
|
> **Note**: Community deployments are **NOT** maintained by the Elk team. It may not be synced with Elk's source code. Please do your own research about the host servers before using them.
|
||||||
|
|
||||||
## 💖 Sponsors
|
|
||||||
|
|
||||||
We are grateful for the generous sponsorship and help of:
|
|
||||||
|
|
||||||
<a href="https://nuxtlabs.com/" target="_blank" rel="noopener noreferrer" >
|
|
||||||
<img src="./images/nuxtlabs.svg" alt="NuxtLabs" height="85">
|
|
||||||
</a>
|
|
||||||
<br><br>
|
|
||||||
<a href="https://stackblitz.com/" target="_blank" rel="noopener noreferrer" >
|
|
||||||
<img src="./images/stackblitz.svg" alt="StackBlitz" height="85">
|
|
||||||
</a>
|
|
||||||
<br><br>
|
|
||||||
|
|
||||||
And all the companies and individuals sponsoring Elk Team and the members. If you're enjoying the app, consider sponsoring us:
|
|
||||||
|
|
||||||
- [Elk Team's GitHub Sponsors](https://github.com/sponsors/elk-zone)
|
|
||||||
|
|
||||||
Or you can sponsor our core team members individually:
|
|
||||||
|
|
||||||
- [Anthony Fu](https://github.com/sponsors/antfu)
|
|
||||||
- [Daniel Roe](https://github.com/sponsors/danielroe)
|
|
||||||
- [三咲智子 Kevin Deng](https://github.com/sponsors/sxzz)
|
|
||||||
- [Patak](https://github.com/sponsors/patak-dev)
|
|
||||||
|
|
||||||
We would also appreciate sponsoring other contributors to the Elk project. If someone helps you solve an issue or implement a feature you wanted, supporting them would help make this project and OS more sustainable.
|
|
||||||
|
|
||||||
## 📍 Roadmap
|
|
||||||
|
|
||||||
[Open board on Volta](https://volta.net/elk-zone/elk)
|
|
||||||
|
|
||||||
## 🧑💻 Contributing
|
## 🧑💻 Contributing
|
||||||
|
|
||||||
We're really excited that you're interested in contributing to Elk! Before submitting your contribution, please read through the following guide.
|
We're really excited that you're interested in contributing to Elk! Before submitting your contribution, please read through the following guide.
|
||||||
|
|
||||||
### Online
|
|
||||||
|
|
||||||
You can use [StackBlitz Codeflow](https://stackblitz.com/codeflow) to fix bugs or implement features. You'll also see a Codeflow button on PRs to review them without a local setup. Once the elk repo has been cloned in Codeflow, the dev server will start automatically and print the URL to open the App. You should receive a prompt in the bottom-right suggesting to open it in the Editor or in another Tab. To learn more, check out the [Codeflow docs](https://developer.stackblitz.com/codeflow/what-is-codeflow).
|
|
||||||
|
|
||||||
[](https://pr.new/elk-zone/elk)
|
|
||||||
|
|
||||||
### Local Setup
|
### Local Setup
|
||||||
|
|
||||||
Clone the repository and run on the root folder:
|
Clone the repository and run on the root folder:
|
||||||
|
@ -134,7 +73,7 @@ nr test
|
||||||
|
|
||||||
## 📲 PWA
|
## 📲 PWA
|
||||||
|
|
||||||
You can consult the [PWA documentation](https://docs.elk.zone/docs/pwa) to learn more about the PWA capabilities on Elk, how to install Elk PWA in your desktop or mobile device and some hints about PWA stuff on Elk.
|
You can consult the [PWA documentation](https://docs.elk.zone/pwa) to learn more about the PWA capabilities on Elk, how to install Elk PWA in your desktop or mobile device and some hints about PWA stuff on Elk.
|
||||||
|
|
||||||
## 🦄 Stack
|
## 🦄 Stack
|
||||||
|
|
||||||
|
@ -147,7 +86,7 @@ You can consult the [PWA documentation](https://docs.elk.zone/docs/pwa) to learn
|
||||||
- [UnoCSS](https://uno.antfu.me/) - The instant on-demand atomic CSS engine
|
- [UnoCSS](https://uno.antfu.me/) - The instant on-demand atomic CSS engine
|
||||||
- [Iconify](https://github.com/iconify/icon-sets#iconify-icon-sets-in-json-format) - Iconify icon sets in JSON format
|
- [Iconify](https://github.com/iconify/icon-sets#iconify-icon-sets-in-json-format) - Iconify icon sets in JSON format
|
||||||
- [Masto.js](https://neet.github.io/masto.js) - Mastodon API client in TypeScript
|
- [Masto.js](https://neet.github.io/masto.js) - Mastodon API client in TypeScript
|
||||||
- [shiki](https://shiki.matsu.io/) - A beautiful Syntax Highlighter
|
- [shiki](https://shiki.style/) - A beautiful yet powerful syntax highlighter
|
||||||
- [vite-plugin-pwa](https://github.com/vite-pwa/vite-plugin-pwa) - Prompt for update, Web Push Notifications and Web Share Target API
|
- [vite-plugin-pwa](https://github.com/vite-pwa/vite-plugin-pwa) - Prompt for update, Web Push Notifications and Web Share Target API
|
||||||
|
|
||||||
## 👨💻 Contributors
|
## 👨💻 Contributors
|
||||||
|
|
|
@ -4,10 +4,12 @@ provideGlobalCommands()
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
if (process.server && !route.path.startsWith('/settings')) {
|
if (import.meta.server && !route.path.startsWith('/settings')) {
|
||||||
|
const url = useRequestURL()
|
||||||
|
|
||||||
useHead({
|
useHead({
|
||||||
meta: [
|
meta: [
|
||||||
{ property: 'og:url', content: `https://elk.zone${route.path}` },
|
{ property: 'og:url', content: `${url.origin}${route.path}` },
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
}
|
}
|
|
@ -1,13 +1,18 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { mastodon } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
defineProps<{
|
const { account } = defineProps<{
|
||||||
account: mastodon.v1.Account
|
account: mastodon.v1.Account
|
||||||
square?: boolean
|
square?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const loaded = $ref(false)
|
const loaded = ref(false)
|
||||||
const error = $ref(false)
|
const error = ref(false)
|
||||||
|
|
||||||
|
const preferredMotion = usePreferredReducedMotion()
|
||||||
|
const accountAvatarSrc = computed(() => {
|
||||||
|
return preferredMotion.value === 'reduce' ? (account?.avatarStatic ?? account.avatar) : account.avatar
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -16,10 +21,10 @@ const error = $ref(false)
|
||||||
width="400"
|
width="400"
|
||||||
height="400"
|
height="400"
|
||||||
select-none
|
select-none
|
||||||
:src="(error || !loaded) ? 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' : account.avatar"
|
:src="(error || !loaded) ? 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' : accountAvatarSrc"
|
||||||
:alt="$t('account.avatar_description', [account.username])"
|
:alt="$t('account.avatar_description', [account.username])"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
class="account-avatar"
|
class="account-avatar object-cover"
|
||||||
:class="(loaded ? 'bg-base' : 'bg-gray:10') + (square ? ' ' : ' rounded-full')"
|
:class="(loaded ? 'bg-base' : 'bg-gray:10') + (square ? ' ' : ' rounded-full')"
|
||||||
:style="{ 'clip-path': square ? `url(#avatar-mask)` : 'none' }"
|
:style="{ 'clip-path': square ? `url(#avatar-mask)` : 'none' }"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
|
@ -1,16 +1,16 @@
|
||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
import type { mastodon } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
const { account, as = 'div' } = $defineProps<{
|
defineOptions({
|
||||||
|
inheritAttrs: false,
|
||||||
|
})
|
||||||
|
|
||||||
|
const { account, as = 'div' } = defineProps<{
|
||||||
account: mastodon.v1.Account
|
account: mastodon.v1.Account
|
||||||
as?: string
|
as?: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
cacheAccount(account)
|
cacheAccount(account)
|
||||||
|
|
||||||
defineOptions({
|
|
||||||
inheritAttrs: false,
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
|
@ -11,7 +11,7 @@ defineProps<{
|
||||||
text-secondary-light
|
text-secondary-light
|
||||||
>
|
>
|
||||||
<slot name="prepend" />
|
<slot name="prepend" />
|
||||||
<CommonTooltip no-auto-focus :content="$t('account.bot')" :disabled="showLabel">
|
<CommonTooltip :content="$t('account.bot')" :disabled="showLabel">
|
||||||
<div i-mdi:robot-outline />
|
<div i-mdi:robot-outline />
|
||||||
</CommonTooltip>
|
</CommonTooltip>
|
||||||
<div v-if="showLabel">
|
<div v-if="showLabel">
|
|
@ -19,8 +19,10 @@ cacheAccount(account)
|
||||||
overflow-hidden
|
overflow-hidden
|
||||||
:to="getAccountRoute(account)"
|
:to="getAccountRoute(account)"
|
||||||
/>
|
/>
|
||||||
|
<slot>
|
||||||
<div h-full p1 shrink-0>
|
<div h-full p1 shrink-0>
|
||||||
<AccountFollowButton :account="account" :context="relationshipContext" />
|
<AccountFollowButton :account="account" :context="relationshipContext" />
|
||||||
</div>
|
</div>
|
||||||
|
</slot>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { mastodon } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
const { account, hideEmojis = false } = defineProps<{
|
const { hideEmojis = false } = defineProps<{
|
||||||
account: mastodon.v1.Account
|
account: mastodon.v1.Account
|
||||||
hideEmojis?: boolean
|
hideEmojis?: boolean
|
||||||
}>()
|
}>()
|
114
app/components/account/AccountFollowButton.vue
Normal file
114
app/components/account/AccountFollowButton.vue
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { mastodon } from 'masto'
|
||||||
|
import { toggleFollowAccount, useRelationship } from '~/composables/masto/relationship'
|
||||||
|
|
||||||
|
const { account, context, command, ...props } = defineProps<{
|
||||||
|
account: mastodon.v1.Account
|
||||||
|
relationship?: mastodon.v1.Relationship
|
||||||
|
context?: 'followedBy' | 'following'
|
||||||
|
command?: boolean
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
const isSelf = useSelfAccount(() => account)
|
||||||
|
const enable = computed(() => !isSelf.value && currentUser.value)
|
||||||
|
const relationship = computed(() => props.relationship || useRelationship(account).value)
|
||||||
|
const isLoading = computed(() => relationship.value === undefined)
|
||||||
|
|
||||||
|
const { client } = useMasto()
|
||||||
|
|
||||||
|
async function unblock() {
|
||||||
|
relationship.value!.blocking = false
|
||||||
|
try {
|
||||||
|
const newRel = await client.value.v1.accounts.$select(account.id).unblock()
|
||||||
|
Object.assign(relationship!, newRel)
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
// TODO error handling
|
||||||
|
relationship.value!.blocking = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function unmute() {
|
||||||
|
relationship.value!.muting = false
|
||||||
|
try {
|
||||||
|
const newRel = await client.value.v1.accounts.$select(account.id).unmute()
|
||||||
|
Object.assign(relationship!, newRel)
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
// TODO error handling
|
||||||
|
relationship.value!.muting = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
useCommand({
|
||||||
|
scope: 'Actions',
|
||||||
|
order: -2,
|
||||||
|
visible: () => command && enable,
|
||||||
|
name: () => `${relationship.value?.following ? t('account.unfollow') : t('account.follow')} ${getShortHandle(account)}`,
|
||||||
|
icon: 'i-ri:star-line',
|
||||||
|
onActivate: () => toggleFollowAccount(relationship.value!, account),
|
||||||
|
})
|
||||||
|
|
||||||
|
const buttonStyle = computed(() => {
|
||||||
|
if (relationship.value?.blocking)
|
||||||
|
return 'text-inverted bg-red border-red'
|
||||||
|
|
||||||
|
if (relationship.value?.muting)
|
||||||
|
return 'text-base bg-card border-base'
|
||||||
|
|
||||||
|
// If following, use a label style with a strong border for Mutuals
|
||||||
|
if (relationship.value ? relationship.value.following : context === 'following')
|
||||||
|
return `text-base ${relationship.value?.followedBy ? 'border-strong' : 'border-base'}`
|
||||||
|
|
||||||
|
// If loading, use a plain style
|
||||||
|
if (isLoading.value)
|
||||||
|
return 'text-base border-base'
|
||||||
|
|
||||||
|
// If not following, use a button style
|
||||||
|
return 'text-inverted bg-primary border-primary'
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<button
|
||||||
|
v-if="enable"
|
||||||
|
gap-1 items-center group
|
||||||
|
border-1
|
||||||
|
rounded-full flex="~ gap2 center" font-500 min-w-30 h-fit px3 py1
|
||||||
|
:class="buttonStyle"
|
||||||
|
:hover="!relationship?.blocking && !relationship?.muting && relationship?.following ? 'border-red text-red' : 'bg-base border-primary text-primary'"
|
||||||
|
@click="relationship?.blocking ? unblock() : relationship?.muting ? unmute() : toggleFollowAccount(relationship!, account)"
|
||||||
|
>
|
||||||
|
<template v-if="isLoading">
|
||||||
|
<span i-svg-spinners-180-ring-with-bg />
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<template v-if="relationship?.blocking">
|
||||||
|
<span elk-group-hover="hidden">{{ $t('account.blocking') }}</span>
|
||||||
|
<span hidden elk-group-hover="inline">{{ $t('account.unblock') }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-if="relationship?.muting">
|
||||||
|
<span elk-group-hover="hidden">{{ $t('account.muting') }}</span>
|
||||||
|
<span hidden elk-group-hover="inline">{{ $t('account.unmute') }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="relationship ? relationship.following : context === 'following'">
|
||||||
|
<span elk-group-hover="hidden">{{ relationship?.followedBy ? $t('account.mutuals') : $t('account.following') }}</span>
|
||||||
|
<span hidden elk-group-hover="inline">{{ $t('account.unfollow') }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="relationship?.requested">
|
||||||
|
<span elk-group-hover="hidden">{{ $t('account.follow_requested') }}</span>
|
||||||
|
<span hidden elk-group-hover="inline">{{ $t('account.withdraw_follow_request') }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="relationship ? relationship.followedBy : context === 'followedBy'">
|
||||||
|
<span elk-group-hover="hidden">{{ $t('account.follows_you') }}</span>
|
||||||
|
<span hidden elk-group-hover="inline">{{ account.locked ? $t('account.request_follow') : $t('account.follow_back') }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<span>{{ account.locked ? $t('account.request_follow') : $t('account.follow') }}</span>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</button>
|
||||||
|
</template>
|
68
app/components/account/AccountFollowRequestButton.vue
Normal file
68
app/components/account/AccountFollowRequestButton.vue
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
|
const { account, ...props } = defineProps<{
|
||||||
|
account: mastodon.v1.Account
|
||||||
|
relationship?: mastodon.v1.Relationship
|
||||||
|
}>()
|
||||||
|
const relationship = computed(() => props.relationship || useRelationship(account).value)
|
||||||
|
const { client } = useMasto()
|
||||||
|
|
||||||
|
async function authorizeFollowRequest() {
|
||||||
|
relationship.value!.requestedBy = false
|
||||||
|
relationship.value!.followedBy = true
|
||||||
|
try {
|
||||||
|
const newRel = await client.value.v1.followRequests.$select(account.id).authorize()
|
||||||
|
Object.assign(relationship!, newRel)
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
relationship.value!.requestedBy = true
|
||||||
|
relationship.value!.followedBy = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function rejectFollowRequest() {
|
||||||
|
relationship.value!.requestedBy = false
|
||||||
|
try {
|
||||||
|
const newRel = await client.value.v1.followRequests.$select(account.id).reject()
|
||||||
|
Object.assign(relationship!, newRel)
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
relationship.value!.requestedBy = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div flex gap-4>
|
||||||
|
<template v-if="relationship?.requestedBy">
|
||||||
|
<CommonTooltip :content="$t('account.authorize')">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
rounded-full text-sm p2 border-1
|
||||||
|
hover:text-green transition-colors
|
||||||
|
@click="authorizeFollowRequest"
|
||||||
|
>
|
||||||
|
<span block text-current i-ri:check-fill />
|
||||||
|
</button>
|
||||||
|
</CommonTooltip>
|
||||||
|
<CommonTooltip :content="$t('account.reject')">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
rounded-full text-sm p2 border-1
|
||||||
|
hover:text-red transition-colors
|
||||||
|
@click="rejectFollowRequest"
|
||||||
|
>
|
||||||
|
<span block text-current i-ri:close-fill />
|
||||||
|
</button>
|
||||||
|
</CommonTooltip>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<span text-secondary>
|
||||||
|
{{ relationship?.followedBy ? $t('account.authorized') : $t('account.rejected') }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -5,7 +5,7 @@ const { account } = defineProps<{
|
||||||
account: mastodon.v1.Account
|
account: mastodon.v1.Account
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const serverName = $computed(() => getServerName(account))
|
const serverName = computed(() => getServerName(account))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
|
@ -6,29 +6,30 @@ const { account } = defineProps<{
|
||||||
command?: boolean
|
command?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { client } = $(useMasto())
|
const { client } = useMasto()
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
const createdAt = $(useFormattedDateTime(() => account.createdAt, {
|
const createdAt = useFormattedDateTime(() => account.createdAt, {
|
||||||
month: 'long',
|
month: 'long',
|
||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
}))
|
})
|
||||||
|
|
||||||
const relationship = $(useRelationship(account))
|
const relationship = useRelationship(account)
|
||||||
|
|
||||||
const namedFields = ref<mastodon.v1.AccountField[]>([])
|
const namedFields = ref<mastodon.v1.AccountField[]>([])
|
||||||
const iconFields = ref<mastodon.v1.AccountField[]>([])
|
const iconFields = ref<mastodon.v1.AccountField[]>([])
|
||||||
const isEditingPersonalNote = ref<boolean>(false)
|
const isEditingPersonalNote = ref<boolean>(false)
|
||||||
const hasHeader = $computed(() => !account.header.endsWith('/original/missing.png'))
|
const hasHeader = computed(() => !account.header.endsWith('/original/missing.png'))
|
||||||
|
const isCopied = ref<boolean>(false)
|
||||||
|
|
||||||
function getFieldIconTitle(fieldName: string) {
|
function getFieldIconTitle(fieldName: string) {
|
||||||
return fieldName === 'Joined' ? t('account.joined') : fieldName
|
return fieldName === 'Joined' ? t('account.joined') : fieldName
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNotificationIconTitle() {
|
function getNotificationIconTitle() {
|
||||||
return relationship?.notifying ? t('account.notifications_on_post_disable', { username: `@${account.username}` }) : t('account.notifications_on_post_enable', { username: `@${account.username}` })
|
return relationship.value?.notifying ? t('account.notifications_on_post_disable', { username: `@${account.username}` }) : t('account.notifications_on_post_enable', { username: `@${account.username}` })
|
||||||
}
|
}
|
||||||
|
|
||||||
function previewHeader() {
|
function previewHeader() {
|
||||||
|
@ -50,14 +51,14 @@ function previewAvatar() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toggleNotifications() {
|
async function toggleNotifications() {
|
||||||
relationship!.notifying = !relationship?.notifying
|
relationship.value!.notifying = !relationship.value?.notifying
|
||||||
try {
|
try {
|
||||||
const newRel = await client.v1.accounts.follow(account.id, { notify: relationship?.notifying })
|
const newRel = await client.value.v1.accounts.$select(account.id).follow({ notify: relationship.value?.notifying })
|
||||||
Object.assign(relationship!, newRel)
|
Object.assign(relationship!, newRel)
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
// TODO error handling
|
// TODO error handling
|
||||||
relationship!.notifying = !relationship?.notifying
|
relationship.value!.notifying = !relationship.value?.notifying
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,45 +75,70 @@ watchEffect(() => {
|
||||||
})
|
})
|
||||||
icons.push({
|
icons.push({
|
||||||
name: 'Joined',
|
name: 'Joined',
|
||||||
value: createdAt,
|
value: createdAt.value,
|
||||||
})
|
})
|
||||||
|
|
||||||
namedFields.value = named
|
namedFields.value = named
|
||||||
iconFields.value = icons
|
iconFields.value = icons
|
||||||
})
|
})
|
||||||
|
|
||||||
const personalNoteDraft = ref(relationship?.note ?? '')
|
const personalNoteDraft = ref(relationship.value?.note ?? '')
|
||||||
|
watch(relationship, (relationship, oldValue) => {
|
||||||
|
if (!oldValue && relationship)
|
||||||
|
personalNoteDraft.value = relationship.note ?? ''
|
||||||
|
})
|
||||||
|
|
||||||
async function editNote(event: Event) {
|
async function editNote(event: Event) {
|
||||||
if (!event.target || !('value' in event.target) || !relationship)
|
if (!event.target || !('value' in event.target) || !relationship.value)
|
||||||
return
|
return
|
||||||
|
|
||||||
const newNote = event.target?.value as string
|
const newNote = event.target?.value as string
|
||||||
|
|
||||||
if (relationship.note?.trim() === newNote.trim())
|
if (relationship.value.note?.trim() === newNote.trim())
|
||||||
return
|
return
|
||||||
|
|
||||||
const newNoteApiResult = await client.v1.accounts.createNote(account.id, { comment: newNote })
|
const newNoteApiResult = await client.value.v1.accounts.$select(account.id).note.create({ comment: newNote })
|
||||||
relationship.note = newNoteApiResult.note
|
relationship.value.note = newNoteApiResult.note
|
||||||
personalNoteDraft.value = relationship.note ?? ''
|
personalNoteDraft.value = relationship.value.note ?? ''
|
||||||
}
|
}
|
||||||
|
|
||||||
const isSelf = $(useSelfAccount(() => account))
|
const isSelf = useSelfAccount(() => account)
|
||||||
const isNotifiedOnPost = $computed(() => !!relationship?.notifying)
|
const isNotifiedOnPost = computed(() => !!relationship.value?.notifying)
|
||||||
|
|
||||||
const personalNoteMaxLength = 2000
|
const personalNoteMaxLength = 2000
|
||||||
|
|
||||||
|
async function copyAccountName() {
|
||||||
|
try {
|
||||||
|
const shortHandle = getShortHandle(account)
|
||||||
|
const serverName = getServerName(account)
|
||||||
|
const accountName = `${shortHandle}@${serverName}`
|
||||||
|
await navigator.clipboard.writeText(accountName)
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.error('Failed to copy account name:', err)
|
||||||
|
}
|
||||||
|
|
||||||
|
isCopied.value = true
|
||||||
|
setTimeout(() => {
|
||||||
|
isCopied.value = false
|
||||||
|
}, 2000)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div flex flex-col>
|
<div flex flex-col>
|
||||||
|
<div v-if="relationship?.requestedBy" p-4 flex justify-between items-center bg-card>
|
||||||
|
<span text-primary font-bold>{{ $t('account.requested', [account.displayName]) }}</span>
|
||||||
|
<AccountFollowRequestButton :account="account" :relationship="relationship" />
|
||||||
|
</div>
|
||||||
<component :is="hasHeader ? 'button' : 'div'" border="b base" z-1 @click="hasHeader ? previewHeader() : undefined">
|
<component :is="hasHeader ? 'button' : 'div'" border="b base" z-1 @click="hasHeader ? previewHeader() : undefined">
|
||||||
<img h-50 height="200" w-full object-cover :src="account.header" :alt="t('account.profile_description', [account.username])">
|
<img h-50 height="200" w-full object-cover :src="account.header" :alt="t('account.profile_description', [account.username])">
|
||||||
</component>
|
</component>
|
||||||
<div p4 mt--18 flex flex-col gap-4>
|
<div p4 mt--18 flex flex-col gap-4>
|
||||||
<div relative>
|
<div relative>
|
||||||
<div flex justify-between>
|
<div flex justify-between>
|
||||||
<button shrink-0 :class="{ 'rounded-full': !isSelf, 'squircle': isSelf }" w-30 h-30 p1 bg-base border-bg-base z-2 @click="previewAvatar">
|
<button shrink-0 h-full :class="{ 'rounded-full': !isSelf, 'squircle': isSelf }" p1 bg-base border-bg-base z-2 @click="previewAvatar">
|
||||||
<AccountAvatar :square="isSelf" :account="account" hover:opacity-90 transition-opacity />
|
<AccountAvatar :square="isSelf" :account="account" hover:opacity-90 transition-opacity w-28 h-28 />
|
||||||
</button>
|
</button>
|
||||||
<div inset-ie-0 flex="~ wrap row-reverse" gap-2 items-center pt18 justify-start>
|
<div inset-ie-0 flex="~ wrap row-reverse" gap-2 items-center pt18 justify-start>
|
||||||
<!-- Edit profile -->
|
<!-- Edit profile -->
|
||||||
|
@ -161,15 +187,27 @@ const personalNoteMaxLength = 2000
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div flex="~ col gap1" pt2>
|
<div flex="~ col gap1" pt2>
|
||||||
<div flex justify-between>
|
<div flex gap2 items-center flex-wrap>
|
||||||
<AccountDisplayName :account="account" font-bold sm:text-2xl text-xl />
|
<AccountDisplayName :account="account" font-bold sm:text-2xl text-xl />
|
||||||
|
<AccountLockIndicator v-if="account.locked" show-label />
|
||||||
<AccountBotIndicator v-if="account.bot" show-label />
|
<AccountBotIndicator v-if="account.bot" show-label />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div flex items-center gap-1>
|
||||||
<AccountHandle :account="account" overflow-unset line-clamp-unset />
|
<AccountHandle :account="account" overflow-unset line-clamp-unset />
|
||||||
|
<CommonTooltip placement="bottom" :content="$t('account.copy_account_name')" flex>
|
||||||
|
<button text-secondary-light text-sm :class="isCopied ? 'i-ri:check-fill text-green' : 'i-ri:file-copy-line'" @click="copyAccountName">
|
||||||
|
<span sr-only>{{ $t('account.copy_account_name') }}</span>
|
||||||
|
</button>
|
||||||
|
</CommonTooltip>
|
||||||
|
</div>
|
||||||
|
<div self-start mt-1>
|
||||||
|
<AccountRolesIndicator v-if="account.roles?.length" :account="account" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<label
|
<label
|
||||||
v-if="relationship?.note?.length !== 0 || isEditingPersonalNote"
|
v-if="isEditingPersonalNote || (relationship?.note && relationship.note.length > 0)"
|
||||||
space-y-2
|
space-y-2
|
||||||
pb-4
|
pb-4
|
||||||
block
|
block
|
|
@ -5,14 +5,14 @@ const { account } = defineProps<{
|
||||||
account: mastodon.v1.Account
|
account: mastodon.v1.Account
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const relationship = $(useRelationship(account))
|
const relationship = useRelationship(account)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-show="relationship" flex="~ col gap2" rounded min-w-90 max-w-120 z-100 overflow-hidden p-4>
|
<div v-show="relationship" flex="~ col gap2" rounded min-w-90 max-w-120 z-100 overflow-hidden p-4>
|
||||||
<div flex="~ gap2" items-center>
|
<div flex="~ gap2" items-center>
|
||||||
<NuxtLink :to="getAccountRoute(account)" flex-auto rounded-full hover:bg-active transition-100 pe5 me-a>
|
<NuxtLink :to="getAccountRoute(account)" flex-auto rounded-full hover:bg-active transition-100 pe5 me-a>
|
||||||
<AccountInfo :account="account" />
|
<AccountInfo :account="account" :hover-card="false" />
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<AccountFollowButton text-sm :account="account" :relationship="relationship" />
|
<AccountFollowButton text-sm :account="account" :relationship="relationship" />
|
||||||
</div>
|
</div>
|
70
app/components/account/AccountHoverWrapper.vue
Normal file
70
app/components/account/AccountHoverWrapper.vue
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { mastodon } from 'masto'
|
||||||
|
import { fetchAccountByHandle } from '~/composables/cache'
|
||||||
|
|
||||||
|
type WatcherType = [acc?: mastodon.v1.Account | null, h?: string, v?: boolean]
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
inheritAttrs: false,
|
||||||
|
})
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
account?: mastodon.v1.Account | null
|
||||||
|
handle?: string
|
||||||
|
disabled?: boolean
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const accountHover = ref()
|
||||||
|
const hovered = useElementHover(accountHover)
|
||||||
|
const account = ref<mastodon.v1.Account | null | undefined>(props.account)
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => [props.account, props.handle, hovered.value] satisfies WatcherType,
|
||||||
|
([newAccount, newHandle, newVisible], oldProps) => {
|
||||||
|
if (!newVisible || process.test)
|
||||||
|
return
|
||||||
|
|
||||||
|
if (newAccount) {
|
||||||
|
account.value = newAccount
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newHandle) {
|
||||||
|
const [_oldAccount, oldHandle, _oldVisible] = oldProps ?? [undefined, undefined, false]
|
||||||
|
if (!oldHandle || newHandle !== oldHandle || !account.value) {
|
||||||
|
// new handle can be wrong: using server instead of webDomain
|
||||||
|
fetchAccountByHandle(newHandle).then((acc) => {
|
||||||
|
if (newHandle === props.handle)
|
||||||
|
account.value = acc
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
account.value = undefined
|
||||||
|
},
|
||||||
|
{ immediate: true, flush: 'post' },
|
||||||
|
)
|
||||||
|
|
||||||
|
const userSettings = useUserSettings()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<span ref="accountHover">
|
||||||
|
<VMenu
|
||||||
|
v-if="!disabled && account && !getPreferences(userSettings, 'hideAccountHoverCard')"
|
||||||
|
placement="bottom-start"
|
||||||
|
:delay="{ show: 500, hide: 100 }"
|
||||||
|
v-bind="$attrs"
|
||||||
|
:close-on-content-click="false"
|
||||||
|
no-auto-focus
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
<template #popper>
|
||||||
|
<AccountHoverCard v-if="account" :account="account" />
|
||||||
|
</template>
|
||||||
|
</VMenu>
|
||||||
|
<slot v-else />
|
||||||
|
</span>
|
||||||
|
</template>
|
|
@ -1,31 +1,35 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { mastodon } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
const { account, as = 'div' } = defineProps<{
|
defineOptions({
|
||||||
|
inheritAttrs: false,
|
||||||
|
})
|
||||||
|
|
||||||
|
const { as = 'div' } = defineProps<{
|
||||||
account: mastodon.v1.Account
|
account: mastodon.v1.Account
|
||||||
as?: string
|
as?: string
|
||||||
hoverCard?: boolean
|
hoverCard?: boolean
|
||||||
square?: boolean
|
square?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
defineOptions({
|
|
||||||
inheritAttrs: false,
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- TODO: Make this work for both buttons and links -->
|
<!-- TODO: Make this work for both buttons and links -->
|
||||||
<!-- This is sometimes (like in the sidebar) used directly as a button, and sometimes, like in follow notifications, as a link. I think this component may need a second refactor that either lets an implementation pass in a link or an action and adapt to what's passed in, or the implementations need to be updated to wrap in the action they want to take and this be just the layout for these items -->
|
<!-- This is sometimes (like in the sidebar) used directly as a button, and sometimes, like in follow notifications, as a link. I think this component may need a second refactor that either lets an implementation pass in a link or an action and adapt to what's passed in, or the implementations need to be updated to wrap in the action they want to take and this be just the layout for these items -->
|
||||||
<template>
|
<template>
|
||||||
<component :is="as" flex gap-3 v-bind="$attrs">
|
<component :is="as" flex items-center gap-3 v-bind="$attrs">
|
||||||
<AccountHoverWrapper :disabled="!hoverCard" :account="account">
|
<AccountHoverWrapper :disabled="!hoverCard" :account="account">
|
||||||
<AccountBigAvatar :account="account" shrink-0 :square="square" />
|
<AccountBigAvatar :account="account" shrink-0 :square="square" />
|
||||||
</AccountHoverWrapper>
|
</AccountHoverWrapper>
|
||||||
<div flex="~ col" shrink pt-1 h-full overflow-hidden justify-center leading-none select-none>
|
<div flex="~ col" shrink h-full overflow-hidden justify-center leading-none select-none p-1>
|
||||||
<div flex="~" gap-2>
|
<div flex="~" gap-2>
|
||||||
<AccountDisplayName :account="account" font-bold line-clamp-1 ws-pre-wrap break-all text-lg />
|
<AccountDisplayName :account="account" font-bold line-clamp-1 ws-pre-wrap break-all text-lg />
|
||||||
|
<AccountLockIndicator v-if="account.locked" text-xs />
|
||||||
<AccountBotIndicator v-if="account.bot" text-xs />
|
<AccountBotIndicator v-if="account.bot" text-xs />
|
||||||
</div>
|
</div>
|
||||||
<AccountHandle :account="account" text-secondary-light />
|
<AccountHandle :account="account" text-secondary-light />
|
||||||
|
<div self-start mt-1>
|
||||||
|
<AccountRolesIndicator v-if="account.roles?.length" :account="account" :limit="1" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</component>
|
</component>
|
||||||
</template>
|
</template>
|
23
app/components/account/AccountLockIndicator.vue
Normal file
23
app/components/account/AccountLockIndicator.vue
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
defineProps<{
|
||||||
|
showLabel?: boolean
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
flex="~ gap1" items-center
|
||||||
|
:class="{ 'border border-base rounded-md px-1': showLabel }"
|
||||||
|
text-secondary-light
|
||||||
|
>
|
||||||
|
<slot name="prepend" />
|
||||||
|
<CommonTooltip content="Lock" :disabled="showLabel">
|
||||||
|
<div i-ri:lock-line />
|
||||||
|
</CommonTooltip>
|
||||||
|
<div v-if="showLabel">
|
||||||
|
{{ t('account.lock') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -1,5 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { mastodon } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
import { toggleBlockAccount, toggleBlockDomain, toggleMuteAccount } from '~/composables/masto/relationship'
|
||||||
|
|
||||||
const { account } = defineProps<{
|
const { account } = defineProps<{
|
||||||
account: mastodon.v1.Account
|
account: mastodon.v1.Account
|
||||||
|
@ -10,63 +11,33 @@ const emit = defineEmits<{
|
||||||
(evt: 'removeNote'): void
|
(evt: 'removeNote'): void
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
let relationship = $(useRelationship(account))
|
const relationship = useRelationship(account)
|
||||||
|
|
||||||
const isSelf = $(useSelfAccount(() => account))
|
const isSelf = useSelfAccount(() => account)
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const { client } = $(useMasto())
|
const { client } = useMasto()
|
||||||
|
const useStarFavoriteIcon = usePreferences('useStarFavoriteIcon')
|
||||||
|
const { share, isSupported: isShareSupported } = useShare()
|
||||||
|
|
||||||
async function toggleMute() {
|
function shareAccount() {
|
||||||
if (!relationship!.muting && await openConfirmDialog({
|
share({ url: location.href })
|
||||||
title: t('confirm.mute_account.title', [account.acct]),
|
|
||||||
confirm: t('confirm.mute_account.confirm'),
|
|
||||||
cancel: t('confirm.mute_account.cancel'),
|
|
||||||
}) !== 'confirm')
|
|
||||||
return
|
|
||||||
|
|
||||||
relationship!.muting = !relationship!.muting
|
|
||||||
relationship = relationship!.muting
|
|
||||||
? await client.v1.accounts.mute(account.id, {
|
|
||||||
// TODO support more options
|
|
||||||
})
|
|
||||||
: await client.v1.accounts.unmute(account.id)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function toggleBlockUser() {
|
|
||||||
if (!relationship!.blocking && await openConfirmDialog({
|
|
||||||
title: t('confirm.block_account.title', [account.acct]),
|
|
||||||
confirm: t('confirm.block_account.confirm'),
|
|
||||||
cancel: t('confirm.block_account.cancel'),
|
|
||||||
}) !== 'confirm')
|
|
||||||
return
|
|
||||||
|
|
||||||
relationship!.blocking = !relationship!.blocking
|
|
||||||
relationship = await client.v1.accounts[relationship!.blocking ? 'block' : 'unblock'](account.id)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function toggleBlockDomain() {
|
|
||||||
if (!relationship!.domainBlocking && await openConfirmDialog({
|
|
||||||
title: t('confirm.block_domain.title', [getServerName(account)]),
|
|
||||||
confirm: t('confirm.block_domain.confirm'),
|
|
||||||
cancel: t('confirm.block_domain.cancel'),
|
|
||||||
}) !== 'confirm')
|
|
||||||
return
|
|
||||||
|
|
||||||
relationship!.domainBlocking = !relationship!.domainBlocking
|
|
||||||
await client.v1.domainBlocks[relationship!.domainBlocking ? 'block' : 'unblock'](getServerName(account))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toggleReblogs() {
|
async function toggleReblogs() {
|
||||||
if (!relationship!.showingReblogs && await openConfirmDialog({
|
if (!relationship.value!.showingReblogs) {
|
||||||
title: t('confirm.show_reblogs.title', [account.acct]),
|
const dialogChoice = await openConfirmDialog({
|
||||||
|
title: t('confirm.show_reblogs.title'),
|
||||||
|
description: t('confirm.show_reblogs.description', [account.acct]),
|
||||||
confirm: t('confirm.show_reblogs.confirm'),
|
confirm: t('confirm.show_reblogs.confirm'),
|
||||||
cancel: t('confirm.show_reblogs.cancel'),
|
cancel: t('confirm.show_reblogs.cancel'),
|
||||||
}) !== 'confirm')
|
})
|
||||||
|
if (dialogChoice.choice !== 'confirm')
|
||||||
return
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const showingReblogs = !relationship?.showingReblogs
|
const showingReblogs = !relationship.value?.showingReblogs
|
||||||
relationship = await client.v1.accounts.follow(account.id, { reblogs: showingReblogs })
|
relationship.value = await client.value.v1.accounts.$select(account.id).follow({ reblogs: showingReblogs })
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addUserNote() {
|
async function addUserNote() {
|
||||||
|
@ -74,18 +45,18 @@ async function addUserNote() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function removeUserNote() {
|
async function removeUserNote() {
|
||||||
if (!relationship!.note || relationship!.note.length === 0)
|
if (!relationship.value!.note || relationship.value!.note.length === 0)
|
||||||
return
|
return
|
||||||
|
|
||||||
const newNote = await client.v1.accounts.createNote(account.id, { comment: '' })
|
const newNote = await client.value.v1.accounts.$select(account.id).note.create({ comment: '' })
|
||||||
relationship!.note = newNote.note
|
relationship.value!.note = newNote.note
|
||||||
emit('removeNote')
|
emit('removeNote')
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CommonDropdown :eager-mount="command">
|
<CommonDropdown :eager-mount="command">
|
||||||
<button flex gap-1 items-center w-full rounded op75 hover="op100 text-purple" group aria-label="More actions">
|
<button flex gap-1 items-center w-full rounded op75 hover="op100 text-purple" group :aria-label="t('actions.more')">
|
||||||
<div rounded-5 p2 elk-group-hover="bg-purple/10">
|
<div rounded-5 p2 elk-group-hover="bg-purple/10">
|
||||||
<div i-ri:more-2-fill />
|
<div i-ri:more-2-fill />
|
||||||
</div>
|
</div>
|
||||||
|
@ -99,16 +70,26 @@ async function removeUserNote() {
|
||||||
:command="command"
|
:command="command"
|
||||||
/>
|
/>
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
|
<CommonDropdownItem
|
||||||
|
is="button"
|
||||||
|
v-if="isShareSupported"
|
||||||
|
:text="$t('menu.share_account', [`@${account.acct}`])"
|
||||||
|
icon="i-ri:share-line"
|
||||||
|
:command="command"
|
||||||
|
@click="shareAccount()"
|
||||||
|
/>
|
||||||
|
|
||||||
<template v-if="currentUser">
|
<template v-if="currentUser">
|
||||||
<template v-if="!isSelf">
|
<template v-if="!isSelf">
|
||||||
<CommonDropdownItem
|
<CommonDropdownItem
|
||||||
|
is="button"
|
||||||
:text="$t('menu.mention_account', [`@${account.acct}`])"
|
:text="$t('menu.mention_account', [`@${account.acct}`])"
|
||||||
icon="i-ri:at-line"
|
icon="i-ri:at-line"
|
||||||
:command="command"
|
:command="command"
|
||||||
@click="mentionUser(account)"
|
@click="mentionUser(account)"
|
||||||
/>
|
/>
|
||||||
<CommonDropdownItem
|
<CommonDropdownItem
|
||||||
|
is="button"
|
||||||
:text="$t('menu.direct_message_account', [`@${account.acct}`])"
|
:text="$t('menu.direct_message_account', [`@${account.acct}`])"
|
||||||
icon="i-ri:message-3-line"
|
icon="i-ri:message-3-line"
|
||||||
:command="command"
|
:command="command"
|
||||||
|
@ -116,6 +97,7 @@ async function removeUserNote() {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<CommonDropdownItem
|
<CommonDropdownItem
|
||||||
|
is="button"
|
||||||
v-if="!relationship?.showingReblogs"
|
v-if="!relationship?.showingReblogs"
|
||||||
icon="i-ri:repeat-line"
|
icon="i-ri:repeat-line"
|
||||||
:text="$t('menu.show_reblogs', [`@${account.acct}`])"
|
:text="$t('menu.show_reblogs', [`@${account.acct}`])"
|
||||||
|
@ -123,6 +105,7 @@ async function removeUserNote() {
|
||||||
@click="toggleReblogs()"
|
@click="toggleReblogs()"
|
||||||
/>
|
/>
|
||||||
<CommonDropdownItem
|
<CommonDropdownItem
|
||||||
|
is="button"
|
||||||
v-else
|
v-else
|
||||||
:text="$t('menu.hide_reblogs', [`@${account.acct}`])"
|
:text="$t('menu.hide_reblogs', [`@${account.acct}`])"
|
||||||
icon="i-ri:repeat-line"
|
icon="i-ri:repeat-line"
|
||||||
|
@ -131,6 +114,7 @@ async function removeUserNote() {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<CommonDropdownItem
|
<CommonDropdownItem
|
||||||
|
is="button"
|
||||||
v-if="!relationship?.note || relationship?.note?.length === 0"
|
v-if="!relationship?.note || relationship?.note?.length === 0"
|
||||||
:text="$t('menu.add_personal_note', [`@${account.acct}`])"
|
:text="$t('menu.add_personal_note', [`@${account.acct}`])"
|
||||||
icon="i-ri-edit-2-line"
|
icon="i-ri-edit-2-line"
|
||||||
|
@ -138,6 +122,7 @@ async function removeUserNote() {
|
||||||
@click="addUserNote()"
|
@click="addUserNote()"
|
||||||
/>
|
/>
|
||||||
<CommonDropdownItem
|
<CommonDropdownItem
|
||||||
|
is="button"
|
||||||
v-else
|
v-else
|
||||||
:text="$t('menu.remove_personal_note', [`@${account.acct}`])"
|
:text="$t('menu.remove_personal_note', [`@${account.acct}`])"
|
||||||
icon="i-ri-edit-2-line"
|
icon="i-ri-edit-2-line"
|
||||||
|
@ -146,51 +131,65 @@ async function removeUserNote() {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<CommonDropdownItem
|
<CommonDropdownItem
|
||||||
|
is="button"
|
||||||
v-if="!relationship?.muting"
|
v-if="!relationship?.muting"
|
||||||
:text="$t('menu.mute_account', [`@${account.acct}`])"
|
:text="$t('menu.mute_account', [`@${account.acct}`])"
|
||||||
icon="i-ri:volume-up-fill"
|
|
||||||
:command="command"
|
|
||||||
@click="toggleMute()"
|
|
||||||
/>
|
|
||||||
<CommonDropdownItem
|
|
||||||
v-else
|
|
||||||
:text="$t('menu.unmute_account', [`@${account.acct}`])"
|
|
||||||
icon="i-ri:volume-mute-line"
|
icon="i-ri:volume-mute-line"
|
||||||
:command="command"
|
:command="command"
|
||||||
@click="toggleMute()"
|
@click="toggleMuteAccount (relationship!, account)"
|
||||||
|
/>
|
||||||
|
<CommonDropdownItem
|
||||||
|
is="button"
|
||||||
|
v-else
|
||||||
|
:text="$t('menu.unmute_account', [`@${account.acct}`])"
|
||||||
|
icon="i-ri:volume-up-fill"
|
||||||
|
:command="command"
|
||||||
|
@click="toggleMuteAccount (relationship!, account)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<CommonDropdownItem
|
<CommonDropdownItem
|
||||||
|
is="button"
|
||||||
v-if="!relationship?.blocking"
|
v-if="!relationship?.blocking"
|
||||||
:text="$t('menu.block_account', [`@${account.acct}`])"
|
:text="$t('menu.block_account', [`@${account.acct}`])"
|
||||||
icon="i-ri:forbid-2-line"
|
icon="i-ri:forbid-2-line"
|
||||||
:command="command"
|
:command="command"
|
||||||
@click="toggleBlockUser()"
|
@click="toggleBlockAccount (relationship!, account)"
|
||||||
/>
|
/>
|
||||||
<CommonDropdownItem
|
<CommonDropdownItem
|
||||||
|
is="button"
|
||||||
v-else
|
v-else
|
||||||
:text="$t('menu.unblock_account', [`@${account.acct}`])"
|
:text="$t('menu.unblock_account', [`@${account.acct}`])"
|
||||||
icon="i-ri:checkbox-circle-line"
|
icon="i-ri:checkbox-circle-line"
|
||||||
:command="command"
|
:command="command"
|
||||||
@click="toggleBlockUser()"
|
@click="toggleBlockAccount (relationship!, account)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<template v-if="getServerName(account) !== currentServer">
|
<template v-if="getServerName(account) !== currentServer">
|
||||||
<CommonDropdownItem
|
<CommonDropdownItem
|
||||||
|
is="button"
|
||||||
v-if="!relationship?.domainBlocking"
|
v-if="!relationship?.domainBlocking"
|
||||||
:text="$t('menu.block_domain', [getServerName(account)])"
|
:text="$t('menu.block_domain', [getServerName(account)])"
|
||||||
icon="i-ri:shut-down-line"
|
icon="i-ri:shut-down-line"
|
||||||
:command="command"
|
:command="command"
|
||||||
@click="toggleBlockDomain()"
|
@click="toggleBlockDomain(relationship!, account)"
|
||||||
/>
|
/>
|
||||||
<CommonDropdownItem
|
<CommonDropdownItem
|
||||||
|
is="button"
|
||||||
v-else
|
v-else
|
||||||
:text="$t('menu.unblock_domain', [getServerName(account)])"
|
:text="$t('menu.unblock_domain', [getServerName(account)])"
|
||||||
icon="i-ri:restart-line"
|
icon="i-ri:restart-line"
|
||||||
:command="command"
|
:command="command"
|
||||||
@click="toggleBlockDomain()"
|
@click="toggleBlockDomain(relationship!, account)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<CommonDropdownItem
|
||||||
|
is="button"
|
||||||
|
:text="$t('menu.report_account', [`@${account.acct}`])"
|
||||||
|
icon="i-ri:flag-2-line"
|
||||||
|
:command="command"
|
||||||
|
@click="openReportDialog(account)"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
|
@ -198,7 +197,7 @@ async function removeUserNote() {
|
||||||
<CommonDropdownItem :text="$t('account.pinned')" icon="i-ri:pushpin-line" :command="command" />
|
<CommonDropdownItem :text="$t('account.pinned')" icon="i-ri:pushpin-line" :command="command" />
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<NuxtLink to="/favourites">
|
<NuxtLink to="/favourites">
|
||||||
<CommonDropdownItem :text="$t('account.favourites')" icon="i-ri:heart-3-line" :command="command" />
|
<CommonDropdownItem :text="$t('account.favourites')" :icon="useStarFavoriteIcon ? 'i-ri:star-line' : 'i-ri:heart-3-line'" :command="command" />
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<NuxtLink to="/mutes">
|
<NuxtLink to="/mutes">
|
||||||
<CommonDropdownItem :text="$t('account.muted_users')" icon="i-ri:volume-mute-line" :command="command" />
|
<CommonDropdownItem :text="$t('account.muted_users')" icon="i-ri:volume-mute-line" :command="command" />
|
|
@ -1,17 +1,17 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Paginator, mastodon } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
const { paginator, account, context } = defineProps<{
|
const { account, context } = defineProps<{
|
||||||
paginator: Paginator<mastodon.v1.Account[], mastodon.DefaultPaginationParams>
|
paginator: mastodon.Paginator<mastodon.v1.Account[], mastodon.DefaultPaginationParams | undefined>
|
||||||
context?: 'following' | 'followers'
|
context?: 'following' | 'followers'
|
||||||
account?: mastodon.v1.Account
|
account?: mastodon.v1.Account
|
||||||
relationshipContext?: 'followedBy' | 'following'
|
relationshipContext?: 'followedBy' | 'following'
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const fallbackContext = $computed(() => {
|
const fallbackContext = computed(() => {
|
||||||
return ['following', 'followers'].includes(context!)
|
return ['following', 'followers'].includes(context!)
|
||||||
})
|
})
|
||||||
const showOriginSite = $computed(() =>
|
const showOriginSite = computed(() =>
|
||||||
account && account.id !== currentUser.value?.account.id && getServerName(account) !== currentServer.value,
|
account && account.id !== currentUser.value?.account.id && getServerName(account) !== currentServer.value,
|
||||||
)
|
)
|
||||||
</script>
|
</script>
|
|
@ -33,13 +33,21 @@ const userSettings = useUserSettings()
|
||||||
text-secondary exact-active-class="text-primary"
|
text-secondary exact-active-class="text-primary"
|
||||||
>
|
>
|
||||||
<template #default="{ isExactActive }">
|
<template #default="{ isExactActive }">
|
||||||
<CommonLocalizedNumber
|
<template
|
||||||
v-if="!getPreferences(userSettings, 'hideFollowerCount')"
|
v-if="!getPreferences(userSettings, 'hideFollowerCount')"
|
||||||
|
>
|
||||||
|
<CommonLocalizedNumber
|
||||||
|
v-if="account.followingCount >= 0"
|
||||||
keypath="account.following_count"
|
keypath="account.following_count"
|
||||||
:count="account.followingCount"
|
:count="account.followingCount"
|
||||||
font-bold
|
font-bold
|
||||||
:class="isExactActive ? 'text-primary' : 'text-base'"
|
:class="isExactActive ? 'text-primary' : 'text-base'"
|
||||||
/>
|
/>
|
||||||
|
<div v-else flex gap-x-1>
|
||||||
|
<span font-bold text-base>Hidden</span>
|
||||||
|
<span>{{ $t('account.following') }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
<span v-else>{{ $t('account.following') }}</span>
|
<span v-else>{{ $t('account.following') }}</span>
|
||||||
</template>
|
</template>
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
|
@ -50,13 +58,19 @@ const userSettings = useUserSettings()
|
||||||
exact-active-class="text-primary"
|
exact-active-class="text-primary"
|
||||||
>
|
>
|
||||||
<template #default="{ isExactActive }">
|
<template #default="{ isExactActive }">
|
||||||
|
<template v-if="!getPreferences(userSettings, 'hideFollowerCount')">
|
||||||
<CommonLocalizedNumber
|
<CommonLocalizedNumber
|
||||||
v-if="!getPreferences(userSettings, 'hideFollowerCount')"
|
v-if="account.followersCount >= 0"
|
||||||
keypath="account.followers_count"
|
keypath="account.followers_count"
|
||||||
:count="account.followersCount"
|
:count="account.followersCount"
|
||||||
font-bold
|
font-bold
|
||||||
:class="isExactActive ? 'text-primary' : 'text-base'"
|
:class="isExactActive ? 'text-primary' : 'text-base'"
|
||||||
/>
|
/>
|
||||||
|
<div v-else flex gap-x-1>
|
||||||
|
<span font-bold text-base>Hidden</span>
|
||||||
|
<span>{{ $t('account.followers') }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
<span v-else>{{ $t('account.followers') }}</span>
|
<span v-else>{{ $t('account.followers') }}</span>
|
||||||
</template>
|
</template>
|
||||||
</NuxtLink>
|
</NuxtLink>
|
31
app/components/account/AccountRolesIndicator.vue
Normal file
31
app/components/account/AccountRolesIndicator.vue
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
account: mastodon.v1.Account
|
||||||
|
limit?: number
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
flex="~ gap1" items-center
|
||||||
|
class="border border-base rounded-md px-1"
|
||||||
|
text-secondary-light
|
||||||
|
>
|
||||||
|
<slot name="prepend" />
|
||||||
|
<div v-for="role in account.roles?.slice(0, limit)" :key="role.id" flex>
|
||||||
|
<div :style="`color: ${role.color}; border-color: ${role.color}`">
|
||||||
|
{{ role.name }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="limit && account.roles?.length > limit"
|
||||||
|
flex="~ gap1" items-center
|
||||||
|
class="border border-base rounded-md px-1"
|
||||||
|
text-secondary-light
|
||||||
|
>
|
||||||
|
+{{ account.roles?.length - limit }}
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -1,18 +1,18 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { CommonRouteTabOption } from '../common/CommonRouteTabs.vue'
|
import type { CommonRouteTabOption } from '#shared/types'
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
const server = $(computedEager(() => route.params.server as string))
|
const server = computed(() => route.params.server as string)
|
||||||
const account = $(computedEager(() => route.params.account as string))
|
const account = computed(() => route.params.account as string)
|
||||||
|
|
||||||
const tabs = $computed<CommonRouteTabOption[]>(() => [
|
const tabs = computed<CommonRouteTabOption[]>(() => [
|
||||||
{
|
{
|
||||||
name: 'account-index',
|
name: 'account-index',
|
||||||
to: {
|
to: {
|
||||||
name: 'account-index',
|
name: 'account-index',
|
||||||
params: { server, account },
|
params: { server: server.value, account: account.value },
|
||||||
},
|
},
|
||||||
display: t('tab.posts'),
|
display: t('tab.posts'),
|
||||||
icon: 'i-ri:file-list-2-line',
|
icon: 'i-ri:file-list-2-line',
|
||||||
|
@ -21,7 +21,7 @@ const tabs = $computed<CommonRouteTabOption[]>(() => [
|
||||||
name: 'account-replies',
|
name: 'account-replies',
|
||||||
to: {
|
to: {
|
||||||
name: 'account-replies',
|
name: 'account-replies',
|
||||||
params: { server, account },
|
params: { server: server.value, account: account.value },
|
||||||
},
|
},
|
||||||
display: t('tab.posts_with_replies'),
|
display: t('tab.posts_with_replies'),
|
||||||
icon: 'i-ri:chat-1-line',
|
icon: 'i-ri:chat-1-line',
|
||||||
|
@ -30,7 +30,7 @@ const tabs = $computed<CommonRouteTabOption[]>(() => [
|
||||||
name: 'account-media',
|
name: 'account-media',
|
||||||
to: {
|
to: {
|
||||||
name: 'account-media',
|
name: 'account-media',
|
||||||
params: { server, account },
|
params: { server: server.value, account: account.value },
|
||||||
},
|
},
|
||||||
display: t('tab.media'),
|
display: t('tab.media'),
|
||||||
icon: 'i-ri:camera-2-line',
|
icon: 'i-ri:camera-2-line',
|
46
app/components/account/TagHoverWrapper.vue
Normal file
46
app/components/account/TagHoverWrapper.vue
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
inheritAttrs: false,
|
||||||
|
})
|
||||||
|
|
||||||
|
const { tagName } = defineProps<{
|
||||||
|
tagName?: string
|
||||||
|
disabled?: boolean
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const tag = ref<mastodon.v1.Tag>()
|
||||||
|
const tagHover = ref()
|
||||||
|
const hovered = useElementHover(tagHover)
|
||||||
|
|
||||||
|
watch(hovered, (newHovered) => {
|
||||||
|
if (newHovered && tagName) {
|
||||||
|
fetchTag(tagName).then((t) => {
|
||||||
|
tag.value = t
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const userSettings = useUserSettings()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<span ref="tagHover">
|
||||||
|
<VMenu
|
||||||
|
v-if="!disabled && !getPreferences(userSettings, 'hideTagHoverCard')"
|
||||||
|
placement="bottom-start"
|
||||||
|
:delay="{ show: 500, hide: 100 }"
|
||||||
|
v-bind="$attrs"
|
||||||
|
:close-on-content-click="false"
|
||||||
|
no-auto-focus
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
<template #popper>
|
||||||
|
<TagCardSkeleton v-if="!tag" />
|
||||||
|
<TagCard v-else :tag="tag" />
|
||||||
|
</template>
|
||||||
|
</VMenu>
|
||||||
|
<slot v-else />
|
||||||
|
</span>
|
||||||
|
</template>
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import type { LocaleObject } from '@nuxtjs/i18n'
|
||||||
import type { AriaAnnounceType, AriaLive } from '~/composables/aria'
|
import type { AriaAnnounceType, AriaLive } from '~/composables/aria'
|
||||||
import type { LocaleObject } from '#i18n'
|
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { t, locale, locales } = useI18n()
|
const { t, locale, locales } = useI18n()
|
||||||
|
@ -11,16 +11,16 @@ const localeMap = (locales.value as LocaleObject[]).reduce((acc, l) => {
|
||||||
return acc
|
return acc
|
||||||
}, {} as Record<string, string>)
|
}, {} as Record<string, string>)
|
||||||
|
|
||||||
let ariaLive = $ref<AriaLive>('polite')
|
const ariaLive = ref<AriaLive>('polite')
|
||||||
let ariaMessage = $ref<string>('')
|
const ariaMessage = ref<string>('')
|
||||||
|
|
||||||
function onMessage(event: AriaAnnounceType, message?: string) {
|
function onMessage(event: AriaAnnounceType, message?: string) {
|
||||||
if (event === 'announce')
|
if (event === 'announce')
|
||||||
ariaMessage = message!
|
ariaMessage.value = message!
|
||||||
else if (event === 'mute')
|
else if (event === 'mute')
|
||||||
ariaLive = 'off'
|
ariaLive.value = 'off'
|
||||||
else
|
else
|
||||||
ariaLive = 'polite'
|
ariaLive.value = 'polite'
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(locale, (l, ol) => {
|
watch(locale, (l, ol) => {
|
||||||
|
@ -38,12 +38,14 @@ onMounted(() => {
|
||||||
announce(t('a11y.loading_page'))
|
announce(t('a11y.loading_page'))
|
||||||
})
|
})
|
||||||
router.afterEach((to, from) => {
|
router.afterEach((to, from) => {
|
||||||
from && setTimeout(() => {
|
if (from) {
|
||||||
|
setTimeout(() => {
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
const title = document.title.trim().split('|')
|
const title = document.title.trim().split('|')
|
||||||
announce(t('a11y.route_loaded', [title[0]]))
|
announce(t('a11y.route_loaded', [title[0]]))
|
||||||
})
|
})
|
||||||
}, 512)
|
}, 512)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
|
@ -1,17 +1,16 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { AriaLive } from '~/composables/aria'
|
import type { AriaLive } from '~/composables/aria'
|
||||||
|
|
||||||
// tsc complaining when using $defineProps
|
const {
|
||||||
withDefaults(defineProps<{
|
ariaLive = 'polite',
|
||||||
title: string
|
heading = 'h2',
|
||||||
|
messageKey = (message: any) => message,
|
||||||
|
} = defineProps<{
|
||||||
ariaLive?: AriaLive
|
ariaLive?: AriaLive
|
||||||
messageKey?: (message: any) => any
|
|
||||||
heading?: 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
|
heading?: 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
|
||||||
}>(), {
|
title: string
|
||||||
heading: 'h2',
|
messageKey?: (message: any) => any
|
||||||
messageKey: (message: any) => message,
|
}>()
|
||||||
ariaLive: 'polite',
|
|
||||||
})
|
|
||||||
|
|
||||||
const { announceLogs, appendLogs, clearLogs, logs } = useAriaLog()
|
const { announceLogs, appendLogs, clearLogs, logs } = useAriaLog()
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { AriaLive } from '~/composables/aria'
|
import type { AriaLive } from '~/composables/aria'
|
||||||
|
|
||||||
// tsc complaining when using $defineProps
|
const { ariaLive = 'polite' } = defineProps<{
|
||||||
withDefaults(defineProps<{
|
|
||||||
ariaLive?: AriaLive
|
ariaLive?: AriaLive
|
||||||
}>(), {
|
}>()
|
||||||
ariaLive: 'polite',
|
|
||||||
})
|
|
||||||
|
|
||||||
const { announceStatus, clearStatus, status } = useAriaStatus()
|
const { announceStatus, clearStatus, status } = useAriaStatus()
|
||||||
|
|
|
@ -1,19 +1,15 @@
|
||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
import type { ResolvedCommand } from '~/composables/command'
|
import type { ResolvedCommand } from '~/composables/command'
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const { active = false } = defineProps<{
|
||||||
(event: 'activate'): void
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const {
|
|
||||||
cmd,
|
|
||||||
index,
|
|
||||||
active = false,
|
|
||||||
} = $defineProps<{
|
|
||||||
cmd: ResolvedCommand
|
cmd: ResolvedCommand
|
||||||
index: number
|
index: number
|
||||||
active?: boolean
|
active?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(event: 'activate'): void
|
||||||
|
}>()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
|
@ -1,11 +1,11 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const props = defineProps<{
|
const { name } = defineProps<{
|
||||||
name: string
|
name: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const isMac = useIsMac()
|
const isMac = useIsMac()
|
||||||
|
|
||||||
const keys = $computed(() => props.name.toLowerCase().split('+'))
|
const keys = computed(() => name.toLowerCase().split('+'))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { SearchResult as SearchResultType } from '~/composables/masto/search'
|
|
||||||
import type { CommandScope, QueryResult, QueryResultItem } from '~/composables/command'
|
import type { CommandScope, QueryResult, QueryResultItem } from '~/composables/command'
|
||||||
|
import type { SearchResult as SearchResultType } from '~/composables/masto/search'
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(event: 'close'): void
|
(event: 'close'): void
|
||||||
|
@ -10,21 +10,21 @@ const registry = useCommandRegistry()
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const inputEl = $ref<HTMLInputElement>()
|
const inputEl = ref<HTMLInputElement>()
|
||||||
const resultEl = $ref<HTMLDivElement>()
|
const resultEl = ref<HTMLDivElement>()
|
||||||
|
|
||||||
const scopes = $ref<CommandScope[]>([])
|
const scopes = ref<CommandScope[]>([])
|
||||||
let input = $(commandPanelInput)
|
const input = commandPanelInput
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
inputEl?.focus()
|
inputEl.value?.focus()
|
||||||
})
|
})
|
||||||
|
|
||||||
const commandMode = $computed(() => input.startsWith('>'))
|
const commandMode = computed(() => input.value.startsWith('>'))
|
||||||
|
|
||||||
const query = $computed(() => commandMode ? '' : input.trim())
|
const query = computed(() => commandMode.value ? '' : input.value.trim())
|
||||||
|
|
||||||
const { accounts, hashtags, loading } = useSearch($$(query))
|
const { accounts, hashtags, loading } = useSearch(query)
|
||||||
|
|
||||||
function toSearchQueryResultItem(search: SearchResultType): QueryResultItem {
|
function toSearchQueryResultItem(search: SearchResultType): QueryResultItem {
|
||||||
return {
|
return {
|
||||||
|
@ -35,8 +35,8 @@ function toSearchQueryResultItem(search: SearchResultType): QueryResultItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const searchResult = $computed<QueryResult>(() => {
|
const searchResult = computed<QueryResult>(() => {
|
||||||
if (query.length === 0 || loading.value)
|
if (query.value.length === 0 || loading.value)
|
||||||
return { length: 0, items: [], grouped: {} as any }
|
return { length: 0, items: [], grouped: {} as any }
|
||||||
|
|
||||||
// TODO extract this scope
|
// TODO extract this scope
|
||||||
|
@ -61,22 +61,22 @@ const searchResult = $computed<QueryResult>(() => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const result = $computed<QueryResult>(() => commandMode
|
const result = computed<QueryResult>(() => commandMode.value
|
||||||
? registry.query(scopes.map(s => s.id).join('.'), input.slice(1).trim())
|
? registry.query(scopes.value.map(s => s.id).join('.'), input.value.slice(1).trim())
|
||||||
: searchResult,
|
: searchResult.value,
|
||||||
)
|
)
|
||||||
|
|
||||||
const isMac = useIsMac()
|
const isMac = useIsMac()
|
||||||
const modifierKeyName = $computed(() => isMac.value ? '⌘' : 'Ctrl')
|
const modifierKeyName = computed(() => isMac.value ? '⌘' : 'Ctrl')
|
||||||
|
|
||||||
let active = $ref(0)
|
const active = ref(0)
|
||||||
watch($$(result), (n, o) => {
|
watch(result, (n, o) => {
|
||||||
if (n.length !== o.length || !n.items.every((i, idx) => i === o.items[idx]))
|
if (n.length !== o.length || !n.items.every((i, idx) => i === o.items[idx]))
|
||||||
active = 0
|
active.value = 0
|
||||||
})
|
})
|
||||||
|
|
||||||
function findItemEl(index: number) {
|
function findItemEl(index: number) {
|
||||||
return resultEl?.querySelector(`[data-index="${index}"]`) as HTMLDivElement | null
|
return resultEl.value?.querySelector(`[data-index="${index}"]`) as HTMLDivElement | null
|
||||||
}
|
}
|
||||||
function onCommandActivate(item: QueryResultItem) {
|
function onCommandActivate(item: QueryResultItem) {
|
||||||
if (item.onActivate) {
|
if (item.onActivate) {
|
||||||
|
@ -84,14 +84,14 @@ function onCommandActivate(item: QueryResultItem) {
|
||||||
emit('close')
|
emit('close')
|
||||||
}
|
}
|
||||||
else if (item.onComplete) {
|
else if (item.onComplete) {
|
||||||
scopes.push(item.onComplete())
|
scopes.value.push(item.onComplete())
|
||||||
input = '> '
|
input.value = '> '
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function onCommandComplete(item: QueryResultItem) {
|
function onCommandComplete(item: QueryResultItem) {
|
||||||
if (item.onComplete) {
|
if (item.onComplete) {
|
||||||
scopes.push(item.onComplete())
|
scopes.value.push(item.onComplete())
|
||||||
input = '> '
|
input.value = '> '
|
||||||
}
|
}
|
||||||
else if (item.onActivate) {
|
else if (item.onActivate) {
|
||||||
item.onActivate()
|
item.onActivate()
|
||||||
|
@ -105,9 +105,9 @@ function intoView(index: number) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setActive(index: number) {
|
function setActive(index: number) {
|
||||||
const len = result.length
|
const len = result.value.length
|
||||||
active = (index + len) % len
|
active.value = (index + len) % len
|
||||||
intoView(active)
|
intoView(active.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
function onKeyDown(e: KeyboardEvent) {
|
function onKeyDown(e: KeyboardEvent) {
|
||||||
|
@ -118,7 +118,7 @@ function onKeyDown(e: KeyboardEvent) {
|
||||||
break
|
break
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
setActive(active - 1)
|
setActive(active.value - 1)
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ function onKeyDown(e: KeyboardEvent) {
|
||||||
break
|
break
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
setActive(active + 1)
|
setActive(active.value + 1)
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -136,9 +136,9 @@ function onKeyDown(e: KeyboardEvent) {
|
||||||
case 'Home': {
|
case 'Home': {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
active = 0
|
active.value = 0
|
||||||
|
|
||||||
intoView(active)
|
intoView(active.value)
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ function onKeyDown(e: KeyboardEvent) {
|
||||||
case 'End': {
|
case 'End': {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
setActive(result.length - 1)
|
setActive(result.value.length - 1)
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ function onKeyDown(e: KeyboardEvent) {
|
||||||
case 'Enter': {
|
case 'Enter': {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
const cmd = result.items[active]
|
const cmd = result.value.items[active.value]
|
||||||
if (cmd)
|
if (cmd)
|
||||||
onCommandActivate(cmd)
|
onCommandActivate(cmd)
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ function onKeyDown(e: KeyboardEvent) {
|
||||||
case 'Tab': {
|
case 'Tab': {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
const cmd = result.items[active]
|
const cmd = result.value.items[active.value]
|
||||||
if (cmd)
|
if (cmd)
|
||||||
onCommandComplete(cmd)
|
onCommandComplete(cmd)
|
||||||
|
|
||||||
|
@ -172,9 +172,9 @@ function onKeyDown(e: KeyboardEvent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'Backspace': {
|
case 'Backspace': {
|
||||||
if (input === '>' && scopes.length) {
|
if (input.value === '>' && scopes.value.length) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
scopes.pop()
|
scopes.value.pop()
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
|
@ -1,10 +1,8 @@
|
||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(event: 'close'): void
|
(event: 'close'): void
|
||||||
}>()
|
}>()
|
||||||
const { modelValue: visible } = defineModels<{
|
const visible = defineModel<boolean>()
|
||||||
modelValue?: boolean
|
|
||||||
}>()
|
|
||||||
|
|
||||||
function close() {
|
function close() {
|
||||||
emit('close')
|
emit('close')
|
|
@ -1,14 +1,14 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const { blurhash = '', src, srcset, shouldLoadImage = true } = defineProps<{
|
defineOptions({
|
||||||
|
inheritAttrs: false,
|
||||||
|
})
|
||||||
|
|
||||||
|
const { blurhash = '', shouldLoadImage = true } = defineProps<{
|
||||||
blurhash?: string
|
blurhash?: string
|
||||||
src: string
|
src: string
|
||||||
srcset?: string
|
srcset?: string
|
||||||
shouldLoadImage?: boolean
|
shouldLoadImage?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
defineOptions({
|
|
||||||
inheritAttrs: false,
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
|
@ -1,22 +1,28 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
defineProps<{
|
defineProps<{
|
||||||
label: string
|
label?: string
|
||||||
hover?: boolean
|
hover?: boolean
|
||||||
|
iconChecked?: string
|
||||||
|
iconUnchecked?: string
|
||||||
|
checkedIconColor?: string
|
||||||
|
prependCheckbox?: boolean
|
||||||
}>()
|
}>()
|
||||||
const { modelValue } = defineModels<{
|
const modelValue = defineModel<boolean | null>()
|
||||||
modelValue?: boolean
|
|
||||||
}>()
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<label
|
<label
|
||||||
class="common-checkbox flex items-center cursor-pointer py-1 text-md w-full gap-y-1"
|
class="common-checkbox flex items-center cursor-pointer py-1 text-md w-full gap-y-1"
|
||||||
:class="hover ? 'hover:bg-active ms--2 px-4 py-2' : null"
|
:class="hover ? 'hover:bg-active ms--2 px-4 py-2' : null"
|
||||||
|
v-bind="$attrs"
|
||||||
@click.prevent="modelValue = !modelValue"
|
@click.prevent="modelValue = !modelValue"
|
||||||
>
|
>
|
||||||
<span flex-1 ms-2 pointer-events-none>{{ label }}</span>
|
<span v-if="label && !prependCheckbox" flex-1 ms-2 pointer-events-none>{{ label }}</span>
|
||||||
<span
|
<span
|
||||||
:class="modelValue ? 'i-ri:checkbox-line' : 'i-ri:checkbox-blank-line'"
|
:class="[
|
||||||
|
modelValue ? (iconChecked ?? 'i-ri:checkbox-line') : (iconUnchecked ?? 'i-ri:checkbox-blank-line'),
|
||||||
|
modelValue && checkedIconColor,
|
||||||
|
]"
|
||||||
text-lg
|
text-lg
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
/>
|
/>
|
||||||
|
@ -25,6 +31,7 @@ const { modelValue } = defineModels<{
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
sr-only
|
sr-only
|
||||||
>
|
>
|
||||||
|
<span v-if="label && prependCheckbox" flex-1 ms-2 pointer-events-none>{{ label }}</span>
|
||||||
</label>
|
</label>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,30 +1,20 @@
|
||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
import type { Boundaries } from 'vue-advanced-cropper'
|
import type { Boundaries } from 'vue-advanced-cropper'
|
||||||
import { Cropper } from 'vue-advanced-cropper'
|
import { Cropper } from 'vue-advanced-cropper'
|
||||||
import 'vue-advanced-cropper/dist/style.css'
|
import 'vue-advanced-cropper/dist/style.css'
|
||||||
|
|
||||||
export interface Props {
|
const { stencilAspectRatio = 1 / 1, stencilSizePercentage = 0.9 } = defineProps<{
|
||||||
/** Crop frame aspect ratio (width/height), default 1/1 */
|
/** Crop frame aspect ratio (width/height), default 1/1 */
|
||||||
stencilAspectRatio?: number
|
stencilAspectRatio?: number
|
||||||
/** The ratio of the longest edge of the cut box to the length of the cut screen, default 0.9, not more than 1 */
|
/** The ratio of the longest edge of the cut box to the length of the cut screen, default 0.9, not more than 1 */
|
||||||
stencilSizePercentage?: number
|
stencilSizePercentage?: number
|
||||||
}
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
|
||||||
stencilAspectRatio: 1 / 1,
|
|
||||||
stencilSizePercentage: 0.9,
|
|
||||||
})
|
|
||||||
|
|
||||||
const { modelValue: file } = defineModels<{
|
|
||||||
/** Images to be cropped */
|
|
||||||
modelValue: File | null
|
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const file = defineModel<File | null>()
|
||||||
|
|
||||||
const cropperDialog = ref(false)
|
const cropperDialog = ref(false)
|
||||||
|
|
||||||
const cropper = ref<InstanceType<typeof Cropper>>()
|
const cropper = ref<InstanceType<typeof Cropper>>()
|
||||||
|
|
||||||
const cropperFlag = ref(false)
|
const cropperFlag = ref(false)
|
||||||
|
|
||||||
const cropperImage = reactive({
|
const cropperImage = reactive({
|
||||||
src: '',
|
src: '',
|
||||||
type: 'image/jpg',
|
type: 'image/jpg',
|
||||||
|
@ -32,8 +22,8 @@ const cropperImage = reactive({
|
||||||
|
|
||||||
function stencilSize({ boundaries }: { boundaries: Boundaries }) {
|
function stencilSize({ boundaries }: { boundaries: Boundaries }) {
|
||||||
return {
|
return {
|
||||||
width: boundaries.width * props.stencilSizePercentage,
|
width: boundaries.width * stencilSizePercentage,
|
||||||
height: boundaries.height * props.stencilSizePercentage,
|
height: boundaries.height * stencilSizePercentage,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +75,7 @@ function cropImage() {
|
||||||
}"
|
}"
|
||||||
:stencil-size="stencilSize"
|
:stencil-size="stencilSize"
|
||||||
:stencil-props="{
|
:stencil-props="{
|
||||||
aspectRatio: props.stencilAspectRatio,
|
aspectRatio: stencilAspectRatio,
|
||||||
movable: false,
|
movable: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
handlers: {},
|
handlers: {},
|
|
@ -1,52 +1,50 @@
|
||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
import { fileOpen } from 'browser-fs-access'
|
|
||||||
import type { FileWithHandle } from 'browser-fs-access'
|
import type { FileWithHandle } from 'browser-fs-access'
|
||||||
|
import { fileOpen } from 'browser-fs-access'
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const {
|
||||||
|
original,
|
||||||
|
allowedFileTypes = ['image/jpeg', 'image/png'],
|
||||||
|
allowedFileSize = 1024 * 1024 * 5, // 5 MB
|
||||||
|
} = defineProps<{
|
||||||
/** The image src before change */
|
/** The image src before change */
|
||||||
original?: string
|
original?: string
|
||||||
/** Allowed file types */
|
/** Allowed file types */
|
||||||
allowedFileTypes?: string[]
|
allowedFileTypes?: string[]
|
||||||
/** Allowed file size */
|
/** Allowed file size */
|
||||||
allowedFileSize?: number
|
allowedFileSize?: number
|
||||||
|
|
||||||
imgClass?: string
|
imgClass?: string
|
||||||
|
|
||||||
loading?: boolean
|
loading?: boolean
|
||||||
}>(), {
|
}>()
|
||||||
allowedFileTypes: () => ['image/jpeg', 'image/png'],
|
|
||||||
allowedFileSize: 1024 * 1024 * 5, // 5 MB
|
|
||||||
})
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(event: 'pick', value: FileWithHandle): void
|
(event: 'pick', value: FileWithHandle): void
|
||||||
(event: 'error', code: number, message: string): void
|
(event: 'error', code: number, message: string): void
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { modelValue: file } = defineModels<{
|
const file = defineModel<FileWithHandle | null>()
|
||||||
modelValue: FileWithHandle | null
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
const defaultImage = computed(() => props.original || '')
|
const defaultImage = computed(() => original || '')
|
||||||
/** Preview of selected images */
|
/** Preview of selected images */
|
||||||
const previewImage = ref('')
|
const previewImage = ref('')
|
||||||
/** The current images on display */
|
/** The current images on display */
|
||||||
const imageSrc = computed<string>(() => previewImage.value || defaultImage.value)
|
const imageSrc = computed<string>(() => previewImage.value || defaultImage.value)
|
||||||
|
|
||||||
async function pickImage() {
|
async function pickImage() {
|
||||||
if (process.server)
|
if (import.meta.server)
|
||||||
return
|
return
|
||||||
const image = await fileOpen({
|
const image = await fileOpen({
|
||||||
description: 'Image',
|
description: 'Image',
|
||||||
mimeTypes: props.allowedFileTypes,
|
mimeTypes: allowedFileTypes,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!props.allowedFileTypes.includes(image.type)) {
|
if (!allowedFileTypes.includes(image.type)) {
|
||||||
emit('error', 1, t('error.unsupported_file_format'))
|
emit('error', 1, t('error.unsupported_file_format'))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
else if (image.size > props.allowedFileSize) {
|
else if (image.size > allowedFileSize) {
|
||||||
emit('error', 2, t('error.file_size_cannot_exceed_n_mb', [5]))
|
emit('error', 2, t('error.file_size_cannot_exceed_n_mb', [5]))
|
||||||
return
|
return
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
const {
|
const {
|
||||||
zIndex = 100,
|
zIndex = 100,
|
||||||
background = 'transparent',
|
background = 'transparent',
|
||||||
} = $defineProps<{
|
} = defineProps<{
|
||||||
zIndex?: number
|
zIndex?: number
|
||||||
background?: string
|
background?: string
|
||||||
}>()
|
}>()
|
|
@ -1,51 +1,51 @@
|
||||||
<script setup lang="ts" generic="T, O, U = T">
|
<script setup lang="ts" generic="T, O, U = T">
|
||||||
|
import type { mastodon } from 'masto'
|
||||||
// @ts-expect-error missing types
|
// @ts-expect-error missing types
|
||||||
import { DynamicScroller } from 'vue-virtual-scroller'
|
import { DynamicScroller } from 'vue-virtual-scroller'
|
||||||
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css'
|
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css'
|
||||||
import type { Paginator, WsEvents } from 'masto'
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
paginator,
|
paginator,
|
||||||
stream,
|
|
||||||
keyProp = 'id',
|
keyProp = 'id',
|
||||||
virtualScroller = false,
|
virtualScroller = false,
|
||||||
eventType = 'update',
|
stream,
|
||||||
|
eventType,
|
||||||
preprocess,
|
preprocess,
|
||||||
endMessage = true,
|
endMessage = true,
|
||||||
} = defineProps<{
|
} = defineProps<{
|
||||||
paginator: Paginator<T[], O>
|
paginator: mastodon.Paginator<T[], O>
|
||||||
keyProp?: keyof T
|
keyProp?: keyof T
|
||||||
virtualScroller?: boolean
|
virtualScroller?: boolean
|
||||||
stream?: Promise<WsEvents>
|
stream?: mastodon.streaming.Subscription
|
||||||
eventType?: 'notification' | 'update'
|
eventType?: 'update' | 'notification'
|
||||||
preprocess?: (items: (U | T)[]) => U[]
|
preprocess?: (items: (U | T)[]) => U[]
|
||||||
endMessage?: boolean | string
|
endMessage?: boolean | string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
defineSlots<{
|
defineSlots<{
|
||||||
default: {
|
default: (props: {
|
||||||
items: U[]
|
items: U[]
|
||||||
item: U
|
item: U
|
||||||
index: number
|
index: number
|
||||||
active?: boolean
|
active?: boolean
|
||||||
older?: U
|
older: U
|
||||||
newer?: U // newer is undefined when index === 0
|
newer: U // newer is undefined when index === 0
|
||||||
}
|
}) => void
|
||||||
items: {
|
items: (props: {
|
||||||
items: U[]
|
items: U[]
|
||||||
}
|
}) => void
|
||||||
updater: {
|
updater: (props: {
|
||||||
number: number
|
number: number
|
||||||
update: () => void
|
update: () => void
|
||||||
}
|
}) => void
|
||||||
loading: {}
|
loading: (props: object) => void
|
||||||
done: {}
|
done: (props: { items: U[] }) => void
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const nuxtApp = useNuxtApp()
|
const nuxtApp = useNuxtApp()
|
||||||
|
|
||||||
const { items, prevItems, update, state, endAnchor, error } = usePaginator(paginator, $$(stream), eventType, preprocess)
|
const { items, prevItems, update, state, endAnchor, error } = usePaginator(paginator, toRef(() => stream), eventType, preprocess)
|
||||||
|
|
||||||
nuxtApp.hook('elk-logo:click', () => {
|
nuxtApp.hook('elk-logo:click', () => {
|
||||||
update()
|
update()
|
||||||
|
@ -73,7 +73,7 @@ defineExpose({ createEntry, removeEntry, updateEntry })
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<slot v-if="prevItems.length" name="updater" v-bind="{ number: prevItems.length, update }" />
|
<slot v-if="prevItems.length" name="updater" v-bind="{ number: prevItems.length, update }" />
|
||||||
<slot name="items" :items="items">
|
<slot name="items" :items="items as U[]">
|
||||||
<template v-if="virtualScroller">
|
<template v-if="virtualScroller">
|
||||||
<DynamicScroller
|
<DynamicScroller
|
||||||
v-slot="{ item, active, index }"
|
v-slot="{ item, active, index }"
|
||||||
|
@ -83,25 +83,25 @@ defineExpose({ createEntry, removeEntry, updateEntry })
|
||||||
page-mode
|
page-mode
|
||||||
>
|
>
|
||||||
<slot
|
<slot
|
||||||
:key="item[keyProp]"
|
v-bind="{ key: item[keyProp] }"
|
||||||
:item="item"
|
:item="item"
|
||||||
:active="active"
|
:active="active"
|
||||||
:older="items[index + 1]"
|
:older="items[index + 1] as U"
|
||||||
:newer="items[index - 1]"
|
:newer="items[index - 1] as U"
|
||||||
:index="index"
|
:index="index"
|
||||||
:items="items"
|
:items="items as U[]"
|
||||||
/>
|
/>
|
||||||
</DynamicScroller>
|
</DynamicScroller>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<slot
|
<slot
|
||||||
v-for="item, index of items"
|
v-for="(item, index) of items"
|
||||||
:key="(item as any)[keyProp]"
|
v-bind="{ key: (item as U)[keyProp as keyof U] }"
|
||||||
:item="item"
|
:item="item as U"
|
||||||
:older="items[index + 1]"
|
:older="items[index + 1] as U"
|
||||||
:newer="items[index - 1]"
|
:newer="items[index - 1] as U"
|
||||||
:index="index"
|
:index="index"
|
||||||
:items="items"
|
:items="items as U[]"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</slot>
|
</slot>
|
||||||
|
@ -109,9 +109,9 @@ defineExpose({ createEntry, removeEntry, updateEntry })
|
||||||
<slot v-if="state === 'loading'" name="loading">
|
<slot v-if="state === 'loading'" name="loading">
|
||||||
<TimelineSkeleton />
|
<TimelineSkeleton />
|
||||||
</slot>
|
</slot>
|
||||||
<slot v-else-if="state === 'done' && endMessage !== false" name="done">
|
<slot v-else-if="state === 'done' && endMessage !== false" name="done" :items="items as U[]">
|
||||||
<div p5 text-secondary italic text-center>
|
<div p5 text-secondary italic text-center>
|
||||||
{{ t(typeof endMessage === 'string' ? endMessage : 'common.end_of_list') }}
|
{{ t(typeof endMessage === 'string' && items.length <= 0 ? endMessage : 'common.end_of_list') }}
|
||||||
</div>
|
</div>
|
||||||
</slot>
|
</slot>
|
||||||
<div v-else-if="state === 'error'" p5 text-secondary>
|
<div v-else-if="state === 'error'" p5 text-secondary>
|
|
@ -4,9 +4,7 @@ defineProps<{
|
||||||
value: any
|
value: any
|
||||||
hover?: boolean
|
hover?: boolean
|
||||||
}>()
|
}>()
|
||||||
const { modelValue } = defineModels<{
|
const modelValue = defineModel()
|
||||||
modelValue: any
|
|
||||||
}>()
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
86
app/components/common/CommonRouteTabs.vue
Normal file
86
app/components/common/CommonRouteTabs.vue
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { CommonRouteTabMoreOption, CommonRouteTabOption } from '#shared/types'
|
||||||
|
|
||||||
|
const { options, command, preventScrollTop = false } = defineProps<{
|
||||||
|
options: CommonRouteTabOption[]
|
||||||
|
moreOptions?: CommonRouteTabMoreOption
|
||||||
|
command?: boolean
|
||||||
|
replace?: boolean
|
||||||
|
preventScrollTop?: boolean
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
useCommands(() => command
|
||||||
|
? options.map(tab => ({
|
||||||
|
scope: 'Tabs',
|
||||||
|
name: tab.display,
|
||||||
|
icon: tab.icon ?? 'i-ri:file-list-2-line',
|
||||||
|
onActivate: () => router.replace(tab.to),
|
||||||
|
}))
|
||||||
|
: [])
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div flex w-full items-center lg:text-lg of-x-auto scrollbar-hide border="b base">
|
||||||
|
<template
|
||||||
|
v-for="(option, index) in options.filter(item => !item.hide)"
|
||||||
|
:key="option?.name || index"
|
||||||
|
>
|
||||||
|
<NuxtLink
|
||||||
|
v-if="!option.disabled"
|
||||||
|
:to="option.to"
|
||||||
|
:replace="replace"
|
||||||
|
relative flex flex-auto cursor-pointer sm:px6 px2 rounded transition-all
|
||||||
|
tabindex="0"
|
||||||
|
hover:bg-active transition-100
|
||||||
|
exact-active-class="children:(text-secondary !border-primary !op100 !text-base)"
|
||||||
|
@click="!preventScrollTop && $scrollToTop()"
|
||||||
|
>
|
||||||
|
<span ws-nowrap mxa sm:px2 sm:py3 xl:pb4 xl:pt5 py2 text-center border-b-3 text-secondary-light hover:text-secondary border-transparent>{{ option.display || ' ' }}</span>
|
||||||
|
</NuxtLink>
|
||||||
|
<div v-else flex flex-auto sm:px6 px2 xl:pb4 xl:pt5>
|
||||||
|
<span ws-nowrap mxa sm:px2 sm:py3 py2 text-center text-secondary-light op50>{{ option.display }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-if="isHydrated && moreOptions?.options?.length">
|
||||||
|
<CommonDropdown placement="bottom" flex cursor-pointer mx-1.25rem>
|
||||||
|
<CommonTooltip placement="top" :content="moreOptions.tooltip || t('action.more')">
|
||||||
|
<button
|
||||||
|
cursor-pointer
|
||||||
|
flex
|
||||||
|
gap-1
|
||||||
|
w-12
|
||||||
|
rounded
|
||||||
|
hover:bg-active
|
||||||
|
btn-action-icon
|
||||||
|
op75
|
||||||
|
px4
|
||||||
|
group
|
||||||
|
:aria-label="t('action.more')"
|
||||||
|
:class="moreOptions.match ? 'text-primary' : 'text-secondary'"
|
||||||
|
>
|
||||||
|
<span v-if="moreOptions.icon" :class="moreOptions.icon" text-sm me--1 block />
|
||||||
|
<span i-ri:arrow-down-s-line text-sm me--1 block />
|
||||||
|
</button>
|
||||||
|
</CommonTooltip>
|
||||||
|
<template #popper>
|
||||||
|
<NuxtLink
|
||||||
|
v-for="(option, index) in moreOptions.options.filter(item => !item.hide)"
|
||||||
|
:key="option?.name || index"
|
||||||
|
:to="option.to"
|
||||||
|
>
|
||||||
|
<CommonDropdownItem>
|
||||||
|
<span flex="~ row" gap-x-4 items-center :class="option.match ? 'text-primary' : ''">
|
||||||
|
<span v-if="option.icon" :class="[option.icon, option.match ? 'text-primary' : 'text.secondary']" text-md me--1 block />
|
||||||
|
<span v-else block> </span>
|
||||||
|
<span>{{ option.display }}</span>
|
||||||
|
</span>
|
||||||
|
</CommonDropdownItem>
|
||||||
|
</NuxtLink>
|
||||||
|
</template>
|
||||||
|
</commondropdown>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -1,5 +1,9 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const { as = 'div', active } = defineProps<{ as: any; active: boolean }>()
|
const { as = 'div', active } = defineProps<{
|
||||||
|
as?: string
|
||||||
|
active: boolean
|
||||||
|
}>()
|
||||||
|
|
||||||
const el = ref()
|
const el = ref()
|
||||||
|
|
||||||
watch(() => active, (active) => {
|
watch(() => active, (active) => {
|
|
@ -8,11 +8,9 @@ const { options, command } = defineProps<{
|
||||||
command?: boolean
|
command?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { modelValue } = defineModels<{
|
const modelValue = defineModel<string>({ required: true })
|
||||||
modelValue: string
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const tabs = $computed(() => {
|
const tabs = computed(() => {
|
||||||
return options.map((option) => {
|
return options.map((option) => {
|
||||||
if (typeof option === 'string')
|
if (typeof option === 'string')
|
||||||
return { name: option, display: option }
|
return { name: option, display: option }
|
||||||
|
@ -21,12 +19,12 @@ const tabs = $computed(() => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
function toValidName(otpion: string) {
|
function toValidName(option: string) {
|
||||||
return otpion.toLowerCase().replace(/[^a-zA-Z0-9]/g, '-')
|
return option.toLowerCase().replace(/[^a-z0-9]/gi, '-')
|
||||||
}
|
}
|
||||||
|
|
||||||
useCommands(() => command
|
useCommands(() => command
|
||||||
? tabs.map(tab => ({
|
? tabs.value.map(tab => ({
|
||||||
scope: 'Tabs',
|
scope: 'Tabs',
|
||||||
|
|
||||||
name: tab.display,
|
name: tab.display,
|
||||||
|
@ -51,7 +49,7 @@ useCommands(() => command
|
||||||
><label
|
><label
|
||||||
flex flex-auto cursor-pointer px3 m1 rounded transition-all
|
flex flex-auto cursor-pointer px3 m1 rounded transition-all
|
||||||
:for="`tab-${toValidName(option.name)}`"
|
:for="`tab-${toValidName(option.name)}`"
|
||||||
tabindex="1"
|
tabindex="0"
|
||||||
hover:bg-active transition-100
|
hover:bg-active transition-100
|
||||||
@keypress.enter="modelValue = option.name"
|
@keypress.enter="modelValue = option.name"
|
||||||
><span
|
><span
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Popper as VTooltipType } from 'floating-vue/dist'
|
import type { Popper as VTooltipType } from 'floating-vue'
|
||||||
|
|
||||||
export interface Props extends Partial<typeof VTooltipType> {
|
export interface Props extends Partial<typeof VTooltipType> {
|
||||||
content?: string
|
content?: string
|
||||||
|
@ -10,8 +10,10 @@ defineProps<Props>()
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VTooltip
|
<VTooltip
|
||||||
|
v-if="isHydrated"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
auto-hide
|
auto-hide
|
||||||
|
no-auto-focus
|
||||||
>
|
>
|
||||||
<slot />
|
<slot />
|
||||||
<template #popper>
|
<template #popper>
|
23
app/components/common/CommonTrending.vue
Normal file
23
app/components/common/CommonTrending.vue
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
|
const {
|
||||||
|
history,
|
||||||
|
maxDay = 2,
|
||||||
|
} = defineProps<{
|
||||||
|
history: mastodon.v1.TagHistory[]
|
||||||
|
maxDay?: number
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const ongoingHot = computed(() => history.slice(0, maxDay))
|
||||||
|
|
||||||
|
const people = computed(() =>
|
||||||
|
ongoingHot.value.reduce((total: number, item) => total + (Number(item.accounts) || 0), 0),
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<p>
|
||||||
|
{{ $t('command.n_people_in_the_past_n_days', [people, maxDay]) }}
|
||||||
|
</p>
|
||||||
|
</template>
|
|
@ -1,4 +1,4 @@
|
||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
import type { mastodon } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
import sparkline from '@fnando/sparkline'
|
import sparkline from '@fnando/sparkline'
|
||||||
|
|
||||||
|
@ -6,22 +6,22 @@ const {
|
||||||
history,
|
history,
|
||||||
width = 60,
|
width = 60,
|
||||||
height = 40,
|
height = 40,
|
||||||
} = $defineProps<{
|
} = defineProps<{
|
||||||
history?: mastodon.v1.TagHistory[]
|
history?: mastodon.v1.TagHistory[]
|
||||||
width?: number
|
width?: number
|
||||||
height?: number
|
height?: number
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const historyNum = $computed(() => {
|
const historyNum = computed(() => {
|
||||||
if (!history)
|
if (!history)
|
||||||
return [1, 1, 1, 1, 1, 1, 1]
|
return [1, 1, 1, 1, 1, 1, 1]
|
||||||
return [...history].reverse().map(item => Number(item.accounts) || 0)
|
return [...history].reverse().map(item => Number(item.accounts) || 0)
|
||||||
})
|
})
|
||||||
|
|
||||||
const sparklineEl = $ref<SVGSVGElement>()
|
const sparklineEl = ref<SVGSVGElement>()
|
||||||
const sparklineFn = typeof sparkline !== 'function' ? (sparkline as any).default : sparkline
|
const sparklineFn = typeof sparkline !== 'function' ? (sparkline as any).default : sparkline
|
||||||
|
|
||||||
watch([$$(historyNum), $$(sparklineEl)], ([historyNum, sparklineEl]) => {
|
watch([historyNum, sparklineEl], ([historyNum, sparklineEl]) => {
|
||||||
if (!sparklineEl)
|
if (!sparklineEl)
|
||||||
return
|
return
|
||||||
sparklineFn(sparklineEl, historyNum)
|
sparklineFn(sparklineEl, historyNum)
|
|
@ -1,18 +1,18 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const props = defineProps<{
|
|
||||||
count: number
|
|
||||||
keypath: string
|
|
||||||
}>()
|
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { count } = defineProps<{
|
||||||
|
count: number
|
||||||
|
keypath: string
|
||||||
|
}>()
|
||||||
|
|
||||||
const { formatHumanReadableNumber, formatNumber, forSR } = useHumanReadableNumber()
|
const { formatHumanReadableNumber, formatNumber, forSR } = useHumanReadableNumber()
|
||||||
|
|
||||||
const useSR = $computed(() => forSR(props.count))
|
const useSR = computed(() => forSR(count))
|
||||||
const rawNumber = $computed(() => formatNumber(props.count))
|
const rawNumber = computed(() => formatNumber(count))
|
||||||
const humanReadableNumber = $computed(() => formatHumanReadableNumber(props.count))
|
const humanReadableNumber = computed(() => formatHumanReadableNumber(count))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
|
@ -6,11 +6,11 @@ defineProps<{
|
||||||
autoBoundaryMaxSize?: boolean
|
autoBoundaryMaxSize?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const dropdown = $ref<any>()
|
const dropdown = ref<any>()
|
||||||
const colorMode = useColorMode()
|
const colorMode = useColorMode()
|
||||||
|
|
||||||
function hide() {
|
function hide() {
|
||||||
return dropdown.hide()
|
return dropdown.value.hide()
|
||||||
}
|
}
|
||||||
provide(InjectionKeyDropdownContext, {
|
provide(InjectionKeyDropdownContext, {
|
||||||
hide,
|
hide,
|
|
@ -1,16 +1,23 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const props = withDefaults(defineProps<{
|
const {
|
||||||
|
is = 'div',
|
||||||
|
text,
|
||||||
|
description,
|
||||||
|
icon,
|
||||||
|
command,
|
||||||
|
} = defineProps<{
|
||||||
is?: string
|
is?: string
|
||||||
text?: string
|
text?: string
|
||||||
description?: string
|
description?: string
|
||||||
icon?: string
|
icon?: string
|
||||||
checked?: boolean
|
checked?: boolean
|
||||||
command?: boolean
|
command?: boolean
|
||||||
}>(), {
|
}>()
|
||||||
is: 'div',
|
|
||||||
})
|
|
||||||
const emit = defineEmits(['click'])
|
const emit = defineEmits(['click'])
|
||||||
|
|
||||||
|
const type = computed(() => is === 'button' ? 'button' : null)
|
||||||
|
|
||||||
const { hide } = useDropdownContext() || {}
|
const { hide } = useDropdownContext() || {}
|
||||||
|
|
||||||
const el = ref<HTMLDivElement>()
|
const el = ref<HTMLDivElement>()
|
||||||
|
@ -24,11 +31,11 @@ useCommand({
|
||||||
scope: 'Actions',
|
scope: 'Actions',
|
||||||
|
|
||||||
order: -1,
|
order: -1,
|
||||||
visible: () => props.command && props.text,
|
visible: () => command && text,
|
||||||
|
|
||||||
name: () => props.text!,
|
name: () => text!,
|
||||||
icon: () => props.icon ?? 'i-ri:question-line',
|
icon: () => icon ?? 'i-ri:question-line',
|
||||||
description: () => props.description,
|
description: () => description,
|
||||||
|
|
||||||
onActivate() {
|
onActivate() {
|
||||||
const clickEvent = new MouseEvent('click', {
|
const clickEvent = new MouseEvent('click', {
|
||||||
|
@ -46,6 +53,7 @@ useCommand({
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
:is="is"
|
:is="is"
|
||||||
ref="el"
|
ref="el"
|
||||||
|
:type="type"
|
||||||
w-full
|
w-full
|
||||||
flex gap-3 items-center cursor-pointer px4 py3
|
flex gap-3 items-center cursor-pointer px4 py3
|
||||||
select-none
|
select-none
|
|
@ -1,10 +1,10 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const props = defineProps<{
|
const { code, lang } = defineProps<{
|
||||||
code: string
|
code: string
|
||||||
lang?: string
|
lang?: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const raw = $computed(() => decodeURIComponent(props.code).replace(/'/g, '\''))
|
const raw = computed(() => decodeURIComponent(code).replace(/'/g, '\''))
|
||||||
|
|
||||||
const langMap: Record<string, string> = {
|
const langMap: Record<string, string> = {
|
||||||
js: 'javascript',
|
js: 'javascript',
|
||||||
|
@ -13,7 +13,7 @@ const langMap: Record<string, string> = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const highlighted = computed(() => {
|
const highlighted = computed(() => {
|
||||||
return props.lang ? highlightCode(raw, (langMap[props.lang] || props.lang) as any) : raw
|
return lang ? highlightCode(raw.value, (langMap[lang] || lang) as any) : raw
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -5,7 +5,7 @@ const { conversation } = defineProps<{
|
||||||
conversation: mastodon.v1.Conversation
|
conversation: mastodon.v1.Conversation
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const withAccounts = $computed(() =>
|
const withAccounts = computed(() =>
|
||||||
conversation.accounts.filter(account => account.id !== conversation.lastStatus?.account.id),
|
conversation.accounts.filter(account => account.id !== conversation.lastStatus?.account.id),
|
||||||
)
|
)
|
||||||
</script>
|
</script>
|
|
@ -1,8 +1,8 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Paginator, mastodon } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
const { paginator } = defineProps<{
|
defineProps<{
|
||||||
paginator: Paginator<mastodon.v1.Conversation[], mastodon.DefaultPaginationParams>
|
paginator: mastodon.Paginator<mastodon.v1.Conversation[], mastodon.DefaultPaginationParams>
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
function preprocess(items: mastodon.v1.Conversation[]): mastodon.v1.Conversation[] {
|
function preprocess(items: mastodon.v1.Conversation[]): mastodon.v1.Conversation[] {
|
30
app/components/emoji/Emoji.vue
Normal file
30
app/components/emoji/Emoji.vue
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
const { alt, dataEmojiId } = defineProps<{
|
||||||
|
as: string
|
||||||
|
alt?: string
|
||||||
|
dataEmojiId?: string
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const title = ref<string | undefined>()
|
||||||
|
|
||||||
|
if (alt) {
|
||||||
|
if (alt.startsWith(':')) {
|
||||||
|
title.value = alt.replace(/:/g, '')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
import('node-emoji').then(({ find }) => {
|
||||||
|
title.value = find(alt)?.key.replace(/_/g, ' ')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if it has a data-emoji-id, use that as the title instead
|
||||||
|
if (dataEmojiId)
|
||||||
|
title.value = dataEmojiId
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<component :is="as" v-bind="$attrs" :alt="alt" :data-emoji-id="dataEmojiId" :title="title">
|
||||||
|
<slot />
|
||||||
|
</component>
|
||||||
|
</template>
|
|
@ -2,12 +2,14 @@
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(event: 'close'): void
|
(event: 'close'): void
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const vAutoFocus = (el: HTMLElement) => el.focus()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div my-8 px-3 sm:px-8 md:max-w-200 flex="~ col gap-4" relative>
|
<div my-8 px-3 sm:px-8 md:max-w-200 flex="~ col gap-4" relative>
|
||||||
<button btn-action-icon absolute top--8 right-0 m1 aria-label="Close" @click="emit('close')">
|
<button v-auto-focus type="button" btn-action-icon absolute top--8 right-0 m1 :aria-label="$t('action.close')" @click="emit('close')">
|
||||||
<div i-ri:close-line />
|
<span i-ri:close-line />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<img :alt="$t('app_logo')" :src="`/${''}logo.svg`" w-20 h-20 height="80" width="80" mxa class="rtl-flip">
|
<img :alt="$t('app_logo')" :src="`/${''}logo.svg`" w-20 h-20 height="80" width="80" mxa class="rtl-flip">
|
||||||
|
@ -28,10 +30,12 @@ const emit = defineEmits<{
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
{{ $t('help.desc_para6') }}
|
{{ $t('help.desc_para6') }}
|
||||||
</p>
|
</p>
|
||||||
|
<NuxtLink hover:text-primary href="https://github.com/sponsors/elk-zone" target="_blank">
|
||||||
{{ $t('help.desc_para3') }}
|
{{ $t('help.desc_para3') }}
|
||||||
<p flex="~ gap-2 wrap" mxa>
|
</NuxtLink>
|
||||||
|
<p flex="~ gap-2 wrap justify-center" mxa>
|
||||||
<template v-for="team of elkTeamMembers" :key="team.github">
|
<template v-for="team of elkTeamMembers" :key="team.github">
|
||||||
<NuxtLink :href="`https://github.com/sponsors/${team.github}`" target="_blank" external rounded-full transition duration-300 border="~ transparent" hover="scale-105 border-primary">
|
<NuxtLink :href="team.link" target="_blank" external rounded-full transition duration-300 border="~ transparent" hover="scale-105 border-primary">
|
||||||
<img :src="`/avatars/${team.github}-100x100.png`" :alt="team.display" rounded-full w-15 h-15 height="60" width="60">
|
<img :src="`/avatars/${team.github}-100x100.png`" :alt="team.display" rounded-full w-15 h-15 height="60" width="60">
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</template>
|
</template>
|
||||||
|
@ -42,7 +46,7 @@ const emit = defineEmits<{
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<button btn-solid mxa tabindex="2" @click="emit('close')">
|
<button type="button" btn-solid mxa @click="emit('close')">
|
||||||
{{ $t('action.enter_app') }}
|
{{ $t('action.enter_app') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
|
@ -15,9 +15,10 @@ const isRemoved = ref(false)
|
||||||
|
|
||||||
async function edit() {
|
async function edit() {
|
||||||
try {
|
try {
|
||||||
isRemoved.value
|
if (isRemoved.value)
|
||||||
? await client.v1.lists.addAccount(list, { accountIds: [account.id] })
|
await client.v1.lists.$select(list).accounts.create({ accountIds: [account.id] })
|
||||||
: await client.v1.lists.removeAccount(list, { accountIds: [account.id] })
|
else
|
||||||
|
await client.v1.lists.$select(list).accounts.remove({ accountIds: [account.id] })
|
||||||
isRemoved.value = !isRemoved.value
|
isRemoved.value = !isRemoved.value
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
@ -39,11 +40,11 @@ async function edit() {
|
||||||
<CommonTooltip
|
<CommonTooltip
|
||||||
:content="isRemoved ? $t('list.add_account') : $t('list.remove_account')"
|
:content="isRemoved ? $t('list.add_account') : $t('list.remove_account')"
|
||||||
:hover="isRemoved ? 'text-green' : 'text-red'"
|
:hover="isRemoved ? 'text-green' : 'text-red'"
|
||||||
no-auto-focus
|
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
text-sm p2 border-1 transition-colors
|
text-sm p2 border-1 transition-colors
|
||||||
border-dark
|
border-dark
|
||||||
|
bg-base
|
||||||
btn-action-icon
|
btn-action-icon
|
||||||
@click="edit"
|
@click="edit"
|
||||||
>
|
>
|
23
app/components/list/AccountSearchResult.vue
Normal file
23
app/components/list/AccountSearchResult.vue
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { SearchResult } from '~/composables/masto/search'
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
result: SearchResult
|
||||||
|
active: boolean
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<CommonScrollIntoView
|
||||||
|
as="div"
|
||||||
|
:active="active"
|
||||||
|
py2 block px2
|
||||||
|
:aria-selected="active"
|
||||||
|
:class="{ 'bg-active': active }"
|
||||||
|
>
|
||||||
|
<AccountInfo
|
||||||
|
v-if="result.type === 'account'"
|
||||||
|
:account="result.data"
|
||||||
|
/>
|
||||||
|
</CommonScrollIntoView>
|
||||||
|
</template>
|
|
@ -6,9 +6,7 @@ const emit = defineEmits<{
|
||||||
(e: 'listUpdated', list: mastodon.v1.List): void
|
(e: 'listUpdated', list: mastodon.v1.List): void
|
||||||
(e: 'listRemoved', id: string): void
|
(e: 'listRemoved', id: string): void
|
||||||
}>()
|
}>()
|
||||||
const { list } = defineModels<{
|
const list = defineModel<mastodon.v1.List>({ required: true })
|
||||||
list: mastodon.v1.List
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const client = useMastoClient()
|
const client = useMastoClient()
|
||||||
|
@ -17,83 +15,84 @@ const { form, isDirty, submitter, reset } = useForm({
|
||||||
form: () => ({ ...list.value }),
|
form: () => ({ ...list.value }),
|
||||||
})
|
})
|
||||||
|
|
||||||
let isEditing = $ref<boolean>(false)
|
const isEditing = ref<boolean>(false)
|
||||||
let deleting = $ref<boolean>(false)
|
const deleting = ref<boolean>(false)
|
||||||
let actionError = $ref<string | undefined>(undefined)
|
const actionError = ref<string | undefined>(undefined)
|
||||||
|
|
||||||
const input = ref<HTMLInputElement>()
|
const input = ref<HTMLInputElement>()
|
||||||
const editBtn = ref<HTMLButtonElement>()
|
const editBtn = ref<HTMLButtonElement>()
|
||||||
const deleteBtn = ref<HTMLButtonElement>()
|
const deleteBtn = ref<HTMLButtonElement>()
|
||||||
|
|
||||||
async function prepareEdit() {
|
async function prepareEdit() {
|
||||||
isEditing = true
|
isEditing.value = true
|
||||||
actionError = undefined
|
actionError.value = undefined
|
||||||
await nextTick()
|
await nextTick()
|
||||||
input.value?.focus()
|
input.value?.focus()
|
||||||
}
|
}
|
||||||
async function cancelEdit() {
|
async function cancelEdit() {
|
||||||
isEditing = false
|
isEditing.value = false
|
||||||
actionError = undefined
|
actionError.value = undefined
|
||||||
reset()
|
|
||||||
|
|
||||||
await nextTick()
|
await nextTick()
|
||||||
|
reset()
|
||||||
editBtn.value?.focus()
|
editBtn.value?.focus()
|
||||||
}
|
}
|
||||||
|
|
||||||
const { submit, submitting } = submitter(async () => {
|
const { submit, submitting } = submitter(async () => {
|
||||||
try {
|
try {
|
||||||
list.value = await client.v1.lists.update(form.id, {
|
list.value = await client.v1.lists.$select(form.id).update({
|
||||||
title: form.title,
|
title: form.title,
|
||||||
})
|
})
|
||||||
cancelEdit()
|
cancelEdit()
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
actionError = (err as Error).message
|
actionError.value = (err as Error).message
|
||||||
await nextTick()
|
await nextTick()
|
||||||
input.value?.focus()
|
input.value?.focus()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
async function removeList() {
|
async function removeList() {
|
||||||
if (deleting)
|
if (deleting.value)
|
||||||
return
|
return
|
||||||
|
|
||||||
const confirmDelete = await openConfirmDialog({
|
const confirmDelete = await openConfirmDialog({
|
||||||
title: t('confirm.delete_list.title', [list.value.title]),
|
title: t('confirm.delete_list.title'),
|
||||||
|
description: t('confirm.delete_list.description', [list.value.title]),
|
||||||
confirm: t('confirm.delete_list.confirm'),
|
confirm: t('confirm.delete_list.confirm'),
|
||||||
cancel: t('confirm.delete_list.cancel'),
|
cancel: t('confirm.delete_list.cancel'),
|
||||||
})
|
})
|
||||||
|
|
||||||
deleting = true
|
deleting.value = true
|
||||||
actionError = undefined
|
actionError.value = undefined
|
||||||
await nextTick()
|
await nextTick()
|
||||||
|
|
||||||
if (confirmDelete === 'confirm') {
|
if (confirmDelete.choice === 'confirm') {
|
||||||
await nextTick()
|
await nextTick()
|
||||||
try {
|
try {
|
||||||
await client.v1.lists.remove(list.value.id)
|
await client.v1.lists.$select(list.value.id).remove()
|
||||||
emit('listRemoved', list.value.id)
|
emit('listRemoved', list.value.id)
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
actionError = (err as Error).message
|
actionError.value = (err as Error).message
|
||||||
await nextTick()
|
await nextTick()
|
||||||
deleteBtn.value?.focus()
|
deleteBtn.value?.focus()
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
deleting = false
|
deleting.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
deleting = false
|
deleting.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function clearError() {
|
async function clearError() {
|
||||||
actionError = undefined
|
actionError.value = undefined
|
||||||
await nextTick()
|
await nextTick()
|
||||||
if (isEditing)
|
if (isEditing.value)
|
||||||
input.value?.focus()
|
input.value?.focus()
|
||||||
else
|
else
|
||||||
deleteBtn.value?.focus()
|
deleteBtn.value?.focus()
|
||||||
|
@ -114,7 +113,7 @@ onDeactivated(cancelEdit)
|
||||||
bg-base border="~ base" h10 m2 ps-1 pe-4 rounded-3 w-full flex="~ row"
|
bg-base border="~ base" h10 m2 ps-1 pe-4 rounded-3 w-full flex="~ row"
|
||||||
items-center relative focus-within:box-shadow-outline gap-3
|
items-center relative focus-within:box-shadow-outline gap-3
|
||||||
>
|
>
|
||||||
<CommonTooltip v-if="isEditing" :content="$t('list.cancel_edit')" no-auto-focus>
|
<CommonTooltip v-if="isEditing" :content="$t('list.cancel_edit')">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
rounded-full text-sm p2 transition-colors
|
rounded-full text-sm p2 transition-colors
|
||||||
|
@ -137,7 +136,7 @@ onDeactivated(cancelEdit)
|
||||||
{{ form.title }}
|
{{ form.title }}
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<div mr4 flex gap2>
|
<div mr4 flex gap2>
|
||||||
<CommonTooltip v-if="isEditing" :content="$t('list.save')" no-auto-focus>
|
<CommonTooltip v-if="isEditing" :content="$t('list.save')">
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
text-sm p2 border-1 transition-colors
|
text-sm p2 border-1 transition-colors
|
||||||
|
@ -153,7 +152,7 @@ onDeactivated(cancelEdit)
|
||||||
</template>
|
</template>
|
||||||
</button>
|
</button>
|
||||||
</CommonTooltip>
|
</CommonTooltip>
|
||||||
<CommonTooltip v-else :content="$t('list.edit')" no-auto-focus>
|
<CommonTooltip v-else :content="$t('list.edit')">
|
||||||
<button
|
<button
|
||||||
ref="editBtn"
|
ref="editBtn"
|
||||||
type="button"
|
type="button"
|
||||||
|
@ -165,7 +164,7 @@ onDeactivated(cancelEdit)
|
||||||
<span block text-current i-ri:edit-2-line class="rtl-flip" />
|
<span block text-current i-ri:edit-2-line class="rtl-flip" />
|
||||||
</button>
|
</button>
|
||||||
</CommonTooltip>
|
</CommonTooltip>
|
||||||
<CommonTooltip :content="$t('list.delete')" no-auto-focus>
|
<CommonTooltip :content="$t('list.delete')">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
text-sm p2 border-1 transition-colors
|
text-sm p2 border-1 transition-colors
|
||||||
|
@ -193,7 +192,7 @@ onDeactivated(cancelEdit)
|
||||||
<div aria-hidden="true" i-ri:error-warning-fill />
|
<div aria-hidden="true" i-ri:error-warning-fill />
|
||||||
<p>{{ $t(`list.${isEditing ? 'edit_error' : 'delete_error'}`) }}</p>
|
<p>{{ $t(`list.${isEditing ? 'edit_error' : 'delete_error'}`) }}</p>
|
||||||
</div>
|
</div>
|
||||||
<CommonTooltip placement="bottom" :content="$t('list.clear_error')" no-auto-focus>
|
<CommonTooltip placement="bottom" :content="$t('list.clear_error')">
|
||||||
<button
|
<button
|
||||||
flex rounded-4 p1 hover:bg-active cursor-pointer transition-100 :aria-label="$t('list.clear_error')"
|
flex rounded-4 p1 hover:bg-active cursor-pointer transition-100 :aria-label="$t('list.clear_error')"
|
||||||
@click="clearError"
|
@click="clearError"
|
|
@ -1,11 +1,11 @@
|
||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
const { userId } = defineProps<{
|
const { userId } = defineProps<{
|
||||||
userId: string
|
userId: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { client } = $(useMasto())
|
const { client } = useMasto()
|
||||||
const paginator = client.v1.lists.list()
|
const paginator = client.value.v1.lists.list()
|
||||||
const listsWithUser = ref((await client.v1.accounts.listLists(userId)).map(list => list.id))
|
const listsWithUser = ref((await client.value.v1.accounts.$select(userId).lists.list()).map(list => list.id))
|
||||||
|
|
||||||
function indexOfUserInList(listId: string) {
|
function indexOfUserInList(listId: string) {
|
||||||
return listsWithUser.value.indexOf(listId)
|
return listsWithUser.value.indexOf(listId)
|
||||||
|
@ -15,11 +15,11 @@ async function edit(listId: string) {
|
||||||
try {
|
try {
|
||||||
const index = indexOfUserInList(listId)
|
const index = indexOfUserInList(listId)
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
await client.v1.lists.addAccount(listId, { accountIds: [userId] })
|
await client.value.v1.lists.$select(listId).accounts.create({ accountIds: [userId] })
|
||||||
listsWithUser.value.push(listId)
|
listsWithUser.value.push(listId)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
await client.v1.lists.removeAccount(listId, { accountIds: [userId] })
|
await client.value.v1.lists.$select(listId).accounts.remove({ accountIds: [userId] })
|
||||||
listsWithUser.value = listsWithUser.value.filter(id => id !== listId)
|
listsWithUser.value = listsWithUser.value.filter(id => id !== listId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ async function edit(listId: string) {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CommonPaginator :end-message="false" :paginator="paginator">
|
<CommonPaginator :paginator="paginator">
|
||||||
<template #default="{ item }">
|
<template #default="{ item }">
|
||||||
<div p4 hover:bg-active block w="100%" flex justify-between items-center gap-4>
|
<div p4 hover:bg-active block w="100%" flex justify-between items-center gap-4>
|
||||||
<p>{{ item.title }}</p>
|
<p>{{ item.title }}</p>
|
||||||
|
@ -49,5 +49,13 @@ async function edit(listId: string) {
|
||||||
</CommonTooltip>
|
</CommonTooltip>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<template #done>
|
||||||
|
<NuxtLink
|
||||||
|
p4 hover:bg-active block w="100%" flex justify-between items-center gap-4
|
||||||
|
to="/lists"
|
||||||
|
>
|
||||||
|
<p>{{ $t('list.manage') }}</p>
|
||||||
|
</NuxtLink>
|
||||||
|
</template>
|
||||||
</CommonPaginator>
|
</CommonPaginator>
|
||||||
</template>
|
</template>
|
|
@ -21,7 +21,10 @@ interface ShortcutItemGroup {
|
||||||
items: ShortcutItem[]
|
items: ShortcutItem[]
|
||||||
}
|
}
|
||||||
|
|
||||||
const shortcutItemGroups: ShortcutItemGroup[] = [
|
const isMac = useIsMac()
|
||||||
|
const modifierKeyName = computed(() => isMac.value ? '⌘' : 'Ctrl')
|
||||||
|
|
||||||
|
const shortcutItemGroups = computed<ShortcutItemGroup[]>(() => [
|
||||||
{
|
{
|
||||||
name: t('magic_keys.groups.navigation.title'),
|
name: t('magic_keys.groups.navigation.title'),
|
||||||
items: [
|
items: [
|
||||||
|
@ -29,14 +32,18 @@ const shortcutItemGroups: ShortcutItemGroup[] = [
|
||||||
description: t('magic_keys.groups.navigation.shortcut_help'),
|
description: t('magic_keys.groups.navigation.shortcut_help'),
|
||||||
shortcut: { keys: ['?'], isSequence: false },
|
shortcut: { keys: ['?'], isSequence: false },
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// description: t('magic_keys.groups.navigation.next_status'),
|
description: t('magic_keys.groups.navigation.next_status'),
|
||||||
// shortcut: { keys: ['j'], isSequence: false },
|
shortcut: { keys: ['j'], isSequence: false },
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// description: t('magic_keys.groups.navigation.previous_status'),
|
description: t('magic_keys.groups.navigation.previous_status'),
|
||||||
// shortcut: { keys: ['k'], isSequence: false },
|
shortcut: { keys: ['k'], isSequence: false },
|
||||||
// },
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.navigation.go_to_search'),
|
||||||
|
shortcut: { keys: ['/'], isSequence: false },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.navigation.go_to_home'),
|
description: t('magic_keys.groups.navigation.go_to_home'),
|
||||||
shortcut: { keys: ['g', 'h'], isSequence: true },
|
shortcut: { keys: ['g', 'h'], isSequence: true },
|
||||||
|
@ -45,19 +52,63 @@ const shortcutItemGroups: ShortcutItemGroup[] = [
|
||||||
description: t('magic_keys.groups.navigation.go_to_notifications'),
|
description: t('magic_keys.groups.navigation.go_to_notifications'),
|
||||||
shortcut: { keys: ['g', 'n'], isSequence: true },
|
shortcut: { keys: ['g', 'n'], isSequence: true },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.navigation.go_to_conversations'),
|
||||||
|
shortcut: { keys: ['g', 'c'], isSequence: true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.navigation.go_to_favourites'),
|
||||||
|
shortcut: { keys: ['g', 'f'], isSequence: true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.navigation.go_to_bookmarks'),
|
||||||
|
shortcut: { keys: ['g', 'b'], isSequence: true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.navigation.go_to_explore'),
|
||||||
|
shortcut: { keys: ['g', 'e'], isSequence: true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.navigation.go_to_local'),
|
||||||
|
shortcut: { keys: ['g', 'l'], isSequence: true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.navigation.go_to_federated'),
|
||||||
|
shortcut: { keys: ['g', 't'], isSequence: true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.navigation.go_to_lists'),
|
||||||
|
shortcut: { keys: ['g', 'i'], isSequence: true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.navigation.go_to_settings'),
|
||||||
|
shortcut: { keys: ['g', 's'], isSequence: true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.navigation.go_to_profile'),
|
||||||
|
shortcut: { keys: ['g', 'p'], isSequence: true },
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: t('magic_keys.groups.actions.title'),
|
name: t('magic_keys.groups.actions.title'),
|
||||||
items: [
|
items: [
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.actions.search'),
|
||||||
|
shortcut: { keys: [modifierKeyName.value, 'k'], isSequence: false },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.actions.command_mode'),
|
description: t('magic_keys.groups.actions.command_mode'),
|
||||||
shortcut: { keys: ['cmd', '/'], isSequence: false },
|
shortcut: { keys: [modifierKeyName.value, '/'], isSequence: false },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.actions.compose'),
|
description: t('magic_keys.groups.actions.compose'),
|
||||||
shortcut: { keys: ['c'], isSequence: false },
|
shortcut: { keys: ['c'], isSequence: false },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.actions.show_new_items'),
|
||||||
|
shortcut: { keys: ['.'], isSequence: false },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.actions.favourite'),
|
description: t('magic_keys.groups.actions.favourite'),
|
||||||
shortcut: { keys: ['f'], isSequence: false },
|
shortcut: { keys: ['f'], isSequence: false },
|
||||||
|
@ -72,7 +123,7 @@ const shortcutItemGroups: ShortcutItemGroup[] = [
|
||||||
name: t('magic_keys.groups.media.title'),
|
name: t('magic_keys.groups.media.title'),
|
||||||
items: [],
|
items: [],
|
||||||
},
|
},
|
||||||
]
|
])
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
|
@ -10,6 +10,7 @@ defineProps<{
|
||||||
|
|
||||||
const container = ref()
|
const container = ref()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
const userSettings = useUserSettings()
|
||||||
const { height: windowHeight } = useWindowSize()
|
const { height: windowHeight } = useWindowSize()
|
||||||
const { height: containerHeight } = useElementBounding(container)
|
const { height: containerHeight } = useElementBounding(container)
|
||||||
const wideLayout = computed(() => route.meta.wideLayout ?? false)
|
const wideLayout = computed(() => route.meta.wideLayout ?? false)
|
||||||
|
@ -26,28 +27,32 @@ const containerClass = computed(() => {
|
||||||
<template>
|
<template>
|
||||||
<div ref="container" :class="containerClass">
|
<div ref="container" :class="containerClass">
|
||||||
<div
|
<div
|
||||||
sticky top-0 z10 backdrop-blur
|
sticky top-0 z-20
|
||||||
pt="[env(safe-area-inset-top,0)]"
|
pt="[env(safe-area-inset-top,0)]"
|
||||||
bg="[rgba(var(--rgb-bg-base),0.7)]"
|
bg="[rgba(var(--rgb-bg-base),0.7)]"
|
||||||
class="native:lg:w-[calc(100vw-5rem)] native:xl:w-[calc(135%+(100vw-1200px)/2)]"
|
class="native:lg:w-[calc(100vw-5rem)] native:xl:w-[calc(135%+(100vw-1200px)/2)]"
|
||||||
|
:class="{
|
||||||
|
'backdrop-blur': !getPreferences(userSettings, 'optimizeForLowPerformanceDevice'),
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<div flex justify-between px5 py2 :class="{ 'xl:hidden': $route.name !== 'tag' }" class="native:xl:flex" border="b base">
|
<div flex justify-between gap-2 min-h-53px px5 py1 :class="{ 'xl:hidden': $route.name !== 'tag' }" class="native:xl:flex" border="b base">
|
||||||
<div flex gap-3 items-center :overflow-hidden="!noOverflowHidden ? '' : false" py2 w-full>
|
<div flex gap-2 items-center :overflow-hidden="!noOverflowHidden ? '' : false" w-full>
|
||||||
<NuxtLink
|
<button
|
||||||
v-if="backOnSmallScreen || back" flex="~ gap1" items-center btn-text p-0 xl:hidden
|
v-if="backOnSmallScreen || back"
|
||||||
|
btn-text flex items-center ms="-3" p-3 xl:hidden
|
||||||
:aria-label="$t('nav.back')"
|
:aria-label="$t('nav.back')"
|
||||||
@click="$router.go(-1)"
|
@click="$router.go(-1)"
|
||||||
>
|
>
|
||||||
<div i-ri:arrow-left-line class="rtl-flip" />
|
<div text-lg i-ri:arrow-left-line class="rtl-flip" />
|
||||||
</NuxtLink>
|
</button>
|
||||||
<div :truncate="!noOverflowHidden ? '' : false" flex w-full data-tauri-drag-region class="native-mac:justify-center native-mac:text-center native-mac:sm:justify-start">
|
<div :truncate="!noOverflowHidden ? '' : false" flex w-full data-tauri-drag-region class="native-mac:justify-start native-mac:text-center">
|
||||||
<slot name="title" />
|
<slot name="title" />
|
||||||
</div>
|
</div>
|
||||||
<div sm:hidden h-7 w-1px />
|
<div sm:hidden h-7 w-1px />
|
||||||
</div>
|
</div>
|
||||||
<div flex items-center flex-shrink-0 gap-x-2>
|
<div flex items-center flex-shrink-0 gap-x-2>
|
||||||
<slot name="actions" />
|
<slot name="actions" />
|
||||||
<PwaBadge lg:hidden />
|
<PwaBadge xl:hidden />
|
||||||
<NavUser v-if="isHydrated" />
|
<NavUser v-if="isHydrated" />
|
||||||
<NavUserSkeleton v-else />
|
<NavUserSkeleton v-else />
|
||||||
</div>
|
</div>
|
||||||
|
@ -56,7 +61,7 @@ const containerClass = computed(() => {
|
||||||
<div hidden />
|
<div hidden />
|
||||||
</slot>
|
</slot>
|
||||||
</div>
|
</div>
|
||||||
<PwaInstallPrompt lg:hidden />
|
<PwaInstallPrompt xl:hidden />
|
||||||
<div :class="isHydrated && wideLayout ? 'xl:w-full sm:max-w-600px' : 'sm:max-w-600px md:shrink-0'" m-auto>
|
<div :class="isHydrated && wideLayout ? 'xl:w-full sm:max-w-600px' : 'sm:max-w-600px md:shrink-0'" m-auto>
|
||||||
<div hidden :class="{ 'xl:block': $route.name !== 'tag' && !$slots.header }" h-6 />
|
<div hidden :class="{ 'xl:block': $route.name !== 'tag' && !$slots.header }" h-6 />
|
||||||
<slot />
|
<slot />
|
45
app/components/modal/DurationPicker.vue
Normal file
45
app/components/modal/DurationPicker.vue
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
const model = defineModel<number>()
|
||||||
|
const isValid = defineModel<boolean>('isValid')
|
||||||
|
|
||||||
|
const days = ref<number | ''>(0)
|
||||||
|
const hours = ref<number | ''>(1)
|
||||||
|
const minutes = ref<number | ''>(0)
|
||||||
|
|
||||||
|
watchEffect(() => {
|
||||||
|
if (days.value === '' || hours.value === '' || minutes.value === '') {
|
||||||
|
isValid.value = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const duration
|
||||||
|
= days.value * 24 * 60 * 60
|
||||||
|
+ hours.value * 60 * 60
|
||||||
|
+ minutes.value * 60
|
||||||
|
|
||||||
|
if (duration <= 0) {
|
||||||
|
isValid.value = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
isValid.value = true
|
||||||
|
model.value = duration
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div flex flex-grow-0 gap-2>
|
||||||
|
<label flex items-center gap-2>
|
||||||
|
<input v-model="days" type="number" min="0" max="1999" input-base :class="!isValid ? 'input-error' : null">
|
||||||
|
{{ $t('confirm.mute_account.days', days === '' ? 0 : days) }}
|
||||||
|
</label>
|
||||||
|
<label flex items-center gap-2>
|
||||||
|
<input v-model="hours" type="number" min="0" max="24" input-base :class="!isValid ? 'input-error' : null">
|
||||||
|
{{ $t('confirm.mute_account.hours', hours === '' ? 0 : hours) }}
|
||||||
|
</label>
|
||||||
|
<label flex items-center gap-2>
|
||||||
|
<input v-model="minutes" type="number" min="0" max="59" step="5" input-base :class="!isValid ? 'input-error' : null">
|
||||||
|
{{ $t('confirm.mute_account.minute', minutes === '' ? 0 : minutes) }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</template>
|
56
app/components/modal/ModalConfirm.vue
Normal file
56
app/components/modal/ModalConfirm.vue
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { ConfirmDialogChoice, ConfirmDialogOptions } from '#shared/types'
|
||||||
|
|
||||||
|
const { extraOptionType } = defineProps<ConfirmDialogOptions>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(evt: 'choice', choice: ConfirmDialogChoice): void
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const hasDuration = ref(false)
|
||||||
|
const isValidDuration = ref(true)
|
||||||
|
const duration = ref(60 * 60) // default to 1 hour
|
||||||
|
const shouldMuteNotifications = ref(true)
|
||||||
|
const isMute = computed(() => extraOptionType === 'mute')
|
||||||
|
|
||||||
|
function handleChoice(choice: ConfirmDialogChoice['choice']) {
|
||||||
|
const dialogChoice = {
|
||||||
|
choice,
|
||||||
|
...isMute.value && {
|
||||||
|
extraOptions: {
|
||||||
|
mute: {
|
||||||
|
duration: hasDuration.value ? duration.value : 0,
|
||||||
|
notifications: shouldMuteNotifications.value,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
emit('choice', dialogChoice)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div flex="~ col" gap-6>
|
||||||
|
<div font-bold text-lg>
|
||||||
|
{{ title }}
|
||||||
|
</div>
|
||||||
|
<div v-if="description">
|
||||||
|
{{ description }}
|
||||||
|
</div>
|
||||||
|
<div v-if="isMute" flex-col flex gap-4>
|
||||||
|
<CommonCheckbox v-model="hasDuration" :label="$t('confirm.mute_account.specify_duration')" prepend-checkbox checked-icon-color="text-primary" />
|
||||||
|
<ModalDurationPicker v-if="hasDuration" v-model="duration" v-model:is-valid="isValidDuration" />
|
||||||
|
<CommonCheckbox v-model="shouldMuteNotifications" :label="$t('confirm.mute_account.notifications')" prepend-checkbox checked-icon-color="text-primary" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div flex justify-end gap-2>
|
||||||
|
<button btn-text @click="handleChoice('cancel')">
|
||||||
|
{{ cancel || $t('confirm.common.cancel') }}
|
||||||
|
</button>
|
||||||
|
<button btn-solid :disabled="!isValidDuration" @click="handleChoice('confirm')">
|
||||||
|
{{ confirm || $t('confirm.common.confirm') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import type { ConfirmDialogChoice } from '#shared/types'
|
||||||
import type { mastodon } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
import type { ConfirmDialogChoice } from '~/types'
|
|
||||||
import {
|
import {
|
||||||
isCommandPanelOpen,
|
isCommandPanelOpen,
|
||||||
isConfirmDialogOpen,
|
isConfirmDialogOpen,
|
||||||
|
@ -11,6 +11,7 @@ import {
|
||||||
isMediaPreviewOpen,
|
isMediaPreviewOpen,
|
||||||
isPreviewHelpOpen,
|
isPreviewHelpOpen,
|
||||||
isPublishDialogOpen,
|
isPublishDialogOpen,
|
||||||
|
isReportDialogOpen,
|
||||||
isSigninDialogOpen,
|
isSigninDialogOpen,
|
||||||
} from '~/composables/dialog'
|
} from '~/composables/dialog'
|
||||||
|
|
||||||
|
@ -62,13 +63,14 @@ function handleFavouritedBoostedByClose() {
|
||||||
</ModalDialog>
|
</ModalDialog>
|
||||||
<ModalDialog
|
<ModalDialog
|
||||||
v-model="isPublishDialogOpen"
|
v-model="isPublishDialogOpen"
|
||||||
max-w-180 flex
|
max-w-180 flex w-full
|
||||||
@close="handlePublishClose"
|
@close="handlePublishClose"
|
||||||
>
|
>
|
||||||
<!-- This `w-0` style is used to avoid overflow problems in flex layouts,so don't remove it unless you know what you're doing -->
|
<PublishWidgetList
|
||||||
<PublishWidget
|
|
||||||
v-if="dialogDraftKey"
|
v-if="dialogDraftKey"
|
||||||
:draft-key="dialogDraftKey" expanded flex-1 w-0
|
:draft-key="dialogDraftKey"
|
||||||
|
expanded
|
||||||
|
class="flex-1"
|
||||||
@published="handlePublished"
|
@published="handlePublished"
|
||||||
/>
|
/>
|
||||||
</ModalDialog>
|
</ModalDialog>
|
||||||
|
@ -102,5 +104,8 @@ function handleFavouritedBoostedByClose() {
|
||||||
<ModalDialog v-model="isKeyboardShortcutsDialogOpen" max-w-full sm:max-w-140 md:max-w-170 lg:max-w-220 md:min-w-160>
|
<ModalDialog v-model="isKeyboardShortcutsDialogOpen" max-w-full sm:max-w-140 md:max-w-170 lg:max-w-220 md:min-w-160>
|
||||||
<MagickeysKeyboardShortcuts @close="closeKeyboardShortcuts()" />
|
<MagickeysKeyboardShortcuts @close="closeKeyboardShortcuts()" />
|
||||||
</ModalDialog>
|
</ModalDialog>
|
||||||
|
<ModalDialog v-model="isReportDialogOpen" keep-alive max-w-175>
|
||||||
|
<ReportModal v-if="reportAccount" :account="reportAccount" :status="reportStatus" @close="closeReportDialog()" />
|
||||||
|
</ModalDialog>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
|
@ -1,64 +1,38 @@
|
||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
import { useFocusTrap } from '@vueuse/integrations/useFocusTrap'
|
import { useFocusTrap } from '@vueuse/integrations/useFocusTrap'
|
||||||
|
|
||||||
export interface Props {
|
|
||||||
/**
|
|
||||||
* level of depth
|
|
||||||
*
|
|
||||||
* @default 100
|
|
||||||
*/
|
|
||||||
zIndex?: number
|
|
||||||
|
|
||||||
/**
|
|
||||||
* whether to allow close dialog by clicking mask layer
|
|
||||||
*
|
|
||||||
* @default true
|
|
||||||
*/
|
|
||||||
closeByMask?: boolean
|
|
||||||
|
|
||||||
/**
|
|
||||||
* use v-if, destroy all the internal elements after closed
|
|
||||||
*
|
|
||||||
* @default true
|
|
||||||
*/
|
|
||||||
useVIf?: boolean
|
|
||||||
|
|
||||||
/**
|
|
||||||
* keep the dialog opened even when in other views
|
|
||||||
*
|
|
||||||
* @default false
|
|
||||||
*/
|
|
||||||
keepAlive?: boolean
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The aria-labelledby id for the dialog.
|
|
||||||
*/
|
|
||||||
dialogLabelledBy?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
|
||||||
zIndex: 100,
|
|
||||||
closeByMask: true,
|
|
||||||
useVIf: true,
|
|
||||||
keepAlive: false,
|
|
||||||
})
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
/** v-model dialog visibility */
|
|
||||||
(event: 'close',): void
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const { modelValue: visible } = defineModels<{
|
|
||||||
/** v-model dislog visibility */
|
|
||||||
modelValue: boolean
|
|
||||||
}>()
|
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const {
|
||||||
|
zIndex = 100,
|
||||||
|
closeByMask = true,
|
||||||
|
useVIf = true,
|
||||||
|
keepAlive = false,
|
||||||
|
} = defineProps<{
|
||||||
|
// level of depth
|
||||||
|
zIndex?: number
|
||||||
|
// whether to allow close dialog by clicking mask layer
|
||||||
|
closeByMask?: boolean
|
||||||
|
// use v-if, destroy all the internal elements after closed
|
||||||
|
useVIf?: boolean
|
||||||
|
// keep the dialog opened even when in other views
|
||||||
|
keepAlive?: boolean
|
||||||
|
// The aria-labelledby id for the dialog.
|
||||||
|
dialogLabelledBy?: string
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
/** v-model dialog visibility */
|
||||||
|
(event: 'close'): void
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const visible = defineModel<boolean>({ required: true })
|
||||||
|
|
||||||
const deactivated = useDeactivated()
|
const deactivated = useDeactivated()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
const userSettings = useUserSettings()
|
||||||
|
|
||||||
/** scrollable HTML element */
|
/** scrollable HTML element */
|
||||||
const elDialogMain = ref<HTMLDivElement>()
|
const elDialogMain = ref<HTMLDivElement>()
|
||||||
|
@ -80,12 +54,14 @@ defineExpose({
|
||||||
|
|
||||||
/** close the dialog */
|
/** close the dialog */
|
||||||
function close() {
|
function close() {
|
||||||
|
if (!visible.value)
|
||||||
|
return
|
||||||
visible.value = false
|
visible.value = false
|
||||||
emit('close')
|
emit('close')
|
||||||
}
|
}
|
||||||
|
|
||||||
function clickMask() {
|
function clickMask() {
|
||||||
if (props.closeByMask)
|
if (closeByMask)
|
||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +73,7 @@ watch(visible, (value) => {
|
||||||
|
|
||||||
const notInCurrentPage = computed(() => deactivated.value || routePath.value !== route.path)
|
const notInCurrentPage = computed(() => deactivated.value || routePath.value !== route.path)
|
||||||
watch(notInCurrentPage, (value) => {
|
watch(notInCurrentPage, (value) => {
|
||||||
if (props.keepAlive)
|
if (keepAlive)
|
||||||
return
|
return
|
||||||
if (value)
|
if (value)
|
||||||
close()
|
close()
|
||||||
|
@ -106,7 +82,7 @@ watch(notInCurrentPage, (value) => {
|
||||||
// controls the state of v-if.
|
// controls the state of v-if.
|
||||||
// when useVIf is toggled, v-if has the same state as modelValue, otherwise v-if is true
|
// when useVIf is toggled, v-if has the same state as modelValue, otherwise v-if is true
|
||||||
const isVIf = computed(() => {
|
const isVIf = computed(() => {
|
||||||
return props.useVIf
|
return useVIf
|
||||||
? visible.value
|
? visible.value
|
||||||
: true
|
: true
|
||||||
})
|
})
|
||||||
|
@ -114,7 +90,7 @@ const isVIf = computed(() => {
|
||||||
// controls the state of v-show.
|
// controls the state of v-show.
|
||||||
// when useVIf is toggled, v-show is true, otherwise it has the same state as modelValue
|
// when useVIf is toggled, v-show is true, otherwise it has the same state as modelValue
|
||||||
const isVShow = computed(() => {
|
const isVShow = computed(() => {
|
||||||
return !props.useVIf
|
return !useVIf
|
||||||
? visible.value
|
? visible.value
|
||||||
: true
|
: true
|
||||||
})
|
})
|
||||||
|
@ -157,7 +133,13 @@ useEventListener('keydown', (e: KeyboardEvent) => {
|
||||||
<!-- corresponding to issue: #106, so please don't remove it. -->
|
<!-- corresponding to issue: #106, so please don't remove it. -->
|
||||||
|
|
||||||
<!-- Mask layer: blur -->
|
<!-- Mask layer: blur -->
|
||||||
<div class="dialog-mask" absolute inset-0 z-0 bg-transparent opacity-100 backdrop-filter backdrop-blur-sm touch-none />
|
<div
|
||||||
|
class="dialog-mask"
|
||||||
|
:class="{
|
||||||
|
'backdrop-blur-sm': !getPreferences(userSettings, 'optimizeForLowPerformanceDevice'),
|
||||||
|
}"
|
||||||
|
absolute inset-0 z-0 bg-transparent opacity-100 backdrop-filter touch-none
|
||||||
|
/>
|
||||||
<!-- Mask layer: dimming -->
|
<!-- Mask layer: dimming -->
|
||||||
<div class="dialog-mask" absolute inset-0 z-0 bg-black opacity-48 touch-none h="[calc(100%+0.5px)]" @click="clickMask" />
|
<div class="dialog-mask" absolute inset-0 z-0 bg-black opacity-48 touch-none h="[calc(100%+0.5px)]" @click="clickMask" />
|
||||||
<!-- Dialog container -->
|
<!-- Dialog container -->
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { ErrorDialogData } from '~/types'
|
import type { ErrorDialogData } from '#shared/types'
|
||||||
|
|
||||||
defineProps<ErrorDialogData>()
|
defineProps<ErrorDialogData>()
|
||||||
</script>
|
</script>
|
|
@ -37,27 +37,26 @@ onUnmounted(() => locked.value = false)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div relative h-full w-full flex pt-12 w-100vh @click="onClick">
|
<div relative h-full w-full flex pt-12 @click="onClick">
|
||||||
<button
|
<button
|
||||||
v-if="hasNext" pointer-events-auto btn-action-icon bg="black/20" :aria-label="$t('action.previous')"
|
v-if="hasNext" pointer-events-auto btn-action-icon bg="black/20" :aria-label="$t('action.next')"
|
||||||
hover:bg="black/40" dark:bg="white/30" dark-hover:bg="white/20" absolute top="1/2" right-1 z5
|
hover:bg="black/40" dark:bg="white/30" dark-hover:bg="white/20" absolute top="1/2" right-1 z5
|
||||||
:title="$t('action.next')" @click="next"
|
:title="$t('action.next')" @click="next"
|
||||||
>
|
>
|
||||||
<div i-ri:arrow-right-s-line text-white />
|
<div i-ri:arrow-right-s-line text-white />
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
v-if="hasPrev" pointer-events-auto btn-action-icon bg="black/20" aria-label="action.next"
|
v-if="hasPrev" pointer-events-auto btn-action-icon bg="black/20" :aria-label="$t('action.prev')"
|
||||||
hover:bg="black/40" dark:bg="white/30" dark:hover-bg="white/20" absolute top="1/2" left-1 z5
|
hover:bg="black/40" dark:bg="white/30" dark:hover-bg="white/20" absolute top="1/2" left-1 z5
|
||||||
:title="$t('action.prev')" @click="prev"
|
:title="$t('action.prev')" @click="prev"
|
||||||
>
|
>
|
||||||
<div i-ri:arrow-left-s-line text-white />
|
<div i-ri:arrow-left-s-line text-white />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div flex flex-row items-center mxa>
|
<div flex="~ col center" h-full w-full>
|
||||||
<div flex="~ col center" max-h-full max-w-full>
|
|
||||||
<ModalMediaPreviewCarousel v-model="index" :media="mediaPreviewList" @close="emit('close')" />
|
<ModalMediaPreviewCarousel v-model="index" :media="mediaPreviewList" @close="emit('close')" />
|
||||||
|
|
||||||
<div bg="black/30" dark:bg="white/10" ms-4 mb-6 mt-4 text-white rounded-full flex="~ center shrink-0" overflow-hidden>
|
<div bg="black/30" dark:bg="white/10" mb-6 mt-4 text-white rounded-full flex="~ center shrink-0" overflow-hidden>
|
||||||
<div v-if="mediaPreviewList.length > 1" p="y-1 x-3" rounded-r-0 shrink-0>
|
<div v-if="mediaPreviewList.length > 1" p="y-1 x-3" rounded-r-0 shrink-0>
|
||||||
{{ index + 1 }} / {{ mediaPreviewList.length }}
|
{{ index + 1 }} / {{ mediaPreviewList.length }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -69,11 +68,10 @@ onUnmounted(() => locked.value = false)
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div absolute top-0 w-full flex justify-end>
|
<div absolute top-0 w-full flex justify-end>
|
||||||
<button
|
<button
|
||||||
btn-action-icon bg="black/30" aria-label="action.close" hover:bg="black/40" dark:bg="white/30"
|
btn-action-icon bg="black/30" :aria-label="$t('action.close')" hover:bg="black/40" dark:bg="white/30"
|
||||||
dark:hover-bg="white/20" pointer-events-auto shrink-0 @click="emit('close')"
|
dark:hover-bg="white/20" pointer-events-auto shrink-0 @click="emit('close')"
|
||||||
>
|
>
|
||||||
<div i-ri:close-line text-white />
|
<div i-ri:close-line text-white />
|
286
app/components/modal/ModalMediaPreviewCarousel.vue
Normal file
286
app/components/modal/ModalMediaPreviewCarousel.vue
Normal file
|
@ -0,0 +1,286 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { Vector2 } from '@vueuse/gesture'
|
||||||
|
import type { mastodon } from 'masto'
|
||||||
|
import { useGesture } from '@vueuse/gesture'
|
||||||
|
import { useReducedMotion } from '@vueuse/motion'
|
||||||
|
|
||||||
|
const { media = [] } = defineProps<{
|
||||||
|
media?: mastodon.v1.MediaAttachment[]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(event: 'close'): void
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const modelValue = defineModel<number>({ required: true })
|
||||||
|
|
||||||
|
const slideGap = 20
|
||||||
|
const doubleTapThreshold = 250
|
||||||
|
|
||||||
|
const view = ref()
|
||||||
|
const slider = ref()
|
||||||
|
const slide = ref()
|
||||||
|
const image = ref()
|
||||||
|
|
||||||
|
const reduceMotion = import.meta.server ? ref(false) : useReducedMotion()
|
||||||
|
const isInitialScrollDone = useTimeout(350)
|
||||||
|
const canAnimate = computed(() => isInitialScrollDone.value && !reduceMotion.value)
|
||||||
|
|
||||||
|
const scale = ref(1)
|
||||||
|
const x = ref(0)
|
||||||
|
const y = ref(0)
|
||||||
|
|
||||||
|
const isDragging = ref(false)
|
||||||
|
const isPinching = ref(false)
|
||||||
|
|
||||||
|
const maxZoomOut = ref(1)
|
||||||
|
const isZoomedIn = computed(() => scale.value > 1)
|
||||||
|
|
||||||
|
const enableAutoplay = usePreferences('enableAutoplay')
|
||||||
|
|
||||||
|
function goToFocusedSlide() {
|
||||||
|
scale.value = 1
|
||||||
|
x.value = slide.value[modelValue.value].offsetLeft * scale.value
|
||||||
|
y.value = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
const slideGapAsScale = slideGap / view.value.clientWidth
|
||||||
|
maxZoomOut.value = 1 - slideGapAsScale
|
||||||
|
|
||||||
|
goToFocusedSlide()
|
||||||
|
})
|
||||||
|
watch(modelValue, goToFocusedSlide)
|
||||||
|
|
||||||
|
let lastOrigin = [0, 0]
|
||||||
|
let initialScale = 0
|
||||||
|
useGesture({
|
||||||
|
onPinch({ first, initial: [initialDistance], movement: [deltaDistance], da: [distance], origin, touches }) {
|
||||||
|
isPinching.value = true
|
||||||
|
|
||||||
|
if (first) {
|
||||||
|
initialScale = scale.value
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (touches === 0)
|
||||||
|
handleMouseWheelZoom(initialScale, deltaDistance, origin)
|
||||||
|
else
|
||||||
|
handlePinchZoom(initialScale, initialDistance, distance, origin)
|
||||||
|
}
|
||||||
|
|
||||||
|
lastOrigin = origin
|
||||||
|
},
|
||||||
|
onPinchEnd() {
|
||||||
|
isPinching.value = false
|
||||||
|
isDragging.value = false
|
||||||
|
|
||||||
|
if (!isZoomedIn.value)
|
||||||
|
goToFocusedSlide()
|
||||||
|
},
|
||||||
|
onDrag({ movement, delta, pinching, tap, last, swipe, event, xy }) {
|
||||||
|
event.preventDefault()
|
||||||
|
|
||||||
|
if (pinching)
|
||||||
|
return
|
||||||
|
|
||||||
|
if (last)
|
||||||
|
handleLastDrag(tap, swipe, movement, xy)
|
||||||
|
else
|
||||||
|
handleDrag(delta, movement)
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
domTarget: view,
|
||||||
|
eventOptions: {
|
||||||
|
passive: false,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const shiftRestrictions = computed(() => {
|
||||||
|
const focusedImage = image.value[modelValue.value]
|
||||||
|
const focusedSlide = slide.value[modelValue.value]
|
||||||
|
|
||||||
|
const scaledImageWidth = focusedImage.offsetWidth * scale.value
|
||||||
|
const scaledHorizontalOverflow = scaledImageWidth / 2 - view.value.clientWidth / 2 + slideGap
|
||||||
|
const horizontalOverflow = Math.max(0, scaledHorizontalOverflow / scale.value)
|
||||||
|
|
||||||
|
const scaledImageHeight = focusedImage.offsetHeight * scale.value
|
||||||
|
const scaledVerticalOverflow = scaledImageHeight / 2 - view.value.clientHeight / 2 + slideGap
|
||||||
|
const verticalOverflow = Math.max(0, scaledVerticalOverflow / scale.value)
|
||||||
|
|
||||||
|
return {
|
||||||
|
left: focusedSlide.offsetLeft - horizontalOverflow,
|
||||||
|
right: focusedSlide.offsetLeft + horizontalOverflow,
|
||||||
|
top: focusedSlide.offsetTop - verticalOverflow,
|
||||||
|
bottom: focusedSlide.offsetTop + verticalOverflow,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function handlePinchZoom(initialScale: number, initialDistance: number, distance: number, [originX, originY]: Vector2) {
|
||||||
|
scale.value = initialScale * (distance / initialDistance)
|
||||||
|
scale.value = Math.max(maxZoomOut.value, scale.value)
|
||||||
|
|
||||||
|
const deltaCenterX = originX - lastOrigin[0]
|
||||||
|
const deltaCenterY = originY - lastOrigin[1]
|
||||||
|
|
||||||
|
handleZoomDrag([deltaCenterX, deltaCenterY])
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMouseWheelZoom(initialScale: number, deltaDistance: number, [originX, originY]: Vector2) {
|
||||||
|
scale.value = initialScale + (deltaDistance / 1000)
|
||||||
|
scale.value = Math.max(maxZoomOut.value, scale.value)
|
||||||
|
|
||||||
|
const deltaCenterX = lastOrigin[0] - originX
|
||||||
|
const deltaCenterY = lastOrigin[1] - originY
|
||||||
|
|
||||||
|
handleZoomDrag([deltaCenterX, deltaCenterY])
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleLastDrag(tap: boolean, swipe: Vector2, movement: Vector2, position: Vector2) {
|
||||||
|
isDragging.value = false
|
||||||
|
|
||||||
|
if (tap)
|
||||||
|
handleTap(position)
|
||||||
|
else if (swipe[0] || swipe[1])
|
||||||
|
handleSwipe(swipe, movement)
|
||||||
|
else if (!isZoomedIn.value)
|
||||||
|
slideToClosestSlide()
|
||||||
|
}
|
||||||
|
|
||||||
|
let lastTapAt = 0
|
||||||
|
function handleTap([positionX, positionY]: Vector2) {
|
||||||
|
const now = Date.now()
|
||||||
|
const isDoubleTap = now - lastTapAt < doubleTapThreshold
|
||||||
|
lastTapAt = now
|
||||||
|
|
||||||
|
if (!isDoubleTap)
|
||||||
|
return
|
||||||
|
|
||||||
|
if (isZoomedIn.value) {
|
||||||
|
goToFocusedSlide()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const focusedSlideBounding = slide.value[modelValue.value].getBoundingClientRect()
|
||||||
|
const slideCenterX = focusedSlideBounding.left + focusedSlideBounding.width / 2
|
||||||
|
const slideCenterY = focusedSlideBounding.top + focusedSlideBounding.height / 2
|
||||||
|
|
||||||
|
scale.value = 3
|
||||||
|
x.value += positionX - slideCenterX
|
||||||
|
y.value += positionY - slideCenterY
|
||||||
|
restrictShiftToInsideSlide()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSwipe([horiz, vert]: Vector2, [movementX, movementY]: Vector2) {
|
||||||
|
if (isZoomedIn.value || isPinching.value)
|
||||||
|
return
|
||||||
|
|
||||||
|
const isHorizontalDrag = Math.abs(movementX) >= Math.abs(movementY)
|
||||||
|
|
||||||
|
if (isHorizontalDrag) {
|
||||||
|
if (horiz === 1) // left
|
||||||
|
modelValue.value = Math.max(0, modelValue.value - 1)
|
||||||
|
if (horiz === -1) // right
|
||||||
|
modelValue.value = Math.min(media.length - 1, modelValue.value + 1)
|
||||||
|
}
|
||||||
|
else if (vert === 1 || vert === -1) {
|
||||||
|
emit('close')
|
||||||
|
}
|
||||||
|
|
||||||
|
goToFocusedSlide()
|
||||||
|
}
|
||||||
|
|
||||||
|
function slideToClosestSlide() {
|
||||||
|
const startOfFocusedSlide = slide.value[modelValue.value].offsetLeft * scale.value
|
||||||
|
const slideWidth = slide.value[modelValue.value].offsetWidth * scale.value
|
||||||
|
|
||||||
|
if (x.value > startOfFocusedSlide + slideWidth / 2)
|
||||||
|
modelValue.value = Math.min(media.length - 1, modelValue.value + 1)
|
||||||
|
else if (x.value < startOfFocusedSlide - slideWidth / 2)
|
||||||
|
modelValue.value = Math.max(0, modelValue.value - 1)
|
||||||
|
|
||||||
|
goToFocusedSlide()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDrag(delta: Vector2, movement: Vector2) {
|
||||||
|
isDragging.value = true
|
||||||
|
|
||||||
|
if (isZoomedIn.value)
|
||||||
|
handleZoomDrag(delta)
|
||||||
|
else
|
||||||
|
handleSlideDrag(movement)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleZoomDrag([deltaX, deltaY]: Vector2) {
|
||||||
|
x.value -= deltaX / scale.value
|
||||||
|
y.value -= deltaY / scale.value
|
||||||
|
|
||||||
|
restrictShiftToInsideSlide()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSlideDrag([movementX, movementY]: Vector2) {
|
||||||
|
goToFocusedSlide()
|
||||||
|
|
||||||
|
if (Math.abs(movementY) > Math.abs(movementX)) // vertical movement is more than horizontal
|
||||||
|
y.value -= movementY / scale.value
|
||||||
|
else
|
||||||
|
x.value -= movementX / scale.value
|
||||||
|
|
||||||
|
if (media.length === 1)
|
||||||
|
x.value = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function restrictShiftToInsideSlide() {
|
||||||
|
x.value = Math.min(shiftRestrictions.value.right, Math.max(shiftRestrictions.value.left, x.value))
|
||||||
|
y.value = Math.min(shiftRestrictions.value.bottom, Math.max(shiftRestrictions.value.top, y.value))
|
||||||
|
}
|
||||||
|
|
||||||
|
const sliderStyle = computed(() => {
|
||||||
|
const style = {
|
||||||
|
transform: `scale(${scale.value}) translate(${-x.value}px, ${-y.value}px)`,
|
||||||
|
transition: 'none',
|
||||||
|
gap: `${slideGap}px`,
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canAnimate.value && !isDragging.value && !isPinching.value)
|
||||||
|
style.transition = 'all 0.3s ease'
|
||||||
|
|
||||||
|
return style
|
||||||
|
})
|
||||||
|
|
||||||
|
const imageStyle = computed(() => ({
|
||||||
|
cursor: isDragging.value ? 'grabbing' : 'grab',
|
||||||
|
}))
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div ref="view" flex flex-row h-full w-full overflow-hidden>
|
||||||
|
<div ref="slider" :style="sliderStyle" w-full h-full flex items-center>
|
||||||
|
<div
|
||||||
|
v-for="item in media"
|
||||||
|
:key="item.id"
|
||||||
|
ref="slide"
|
||||||
|
flex-shrink-0
|
||||||
|
w-full
|
||||||
|
h-full
|
||||||
|
flex
|
||||||
|
items-center
|
||||||
|
justify-center
|
||||||
|
>
|
||||||
|
<component
|
||||||
|
:is="item.type === 'gifv' ? 'video' : 'img'"
|
||||||
|
ref="image"
|
||||||
|
:autoplay="enableAutoplay"
|
||||||
|
controls
|
||||||
|
loop
|
||||||
|
select-none
|
||||||
|
max-w-full
|
||||||
|
max-h-full
|
||||||
|
:style="imageStyle"
|
||||||
|
:draggable="false"
|
||||||
|
:src="item.url || item.previewUrl"
|
||||||
|
:alt="item.description || ''"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
64
app/components/nav/NavBottom.vue
Normal file
64
app/components/nav/NavBottom.vue
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { Component } from 'vue'
|
||||||
|
import type { NavButtonName } from '../../composables/settings'
|
||||||
|
|
||||||
|
import {
|
||||||
|
NavButtonBookmark,
|
||||||
|
NavButtonCompose,
|
||||||
|
NavButtonExplore,
|
||||||
|
NavButtonFavorite,
|
||||||
|
NavButtonFederated,
|
||||||
|
NavButtonHashtag,
|
||||||
|
NavButtonHome,
|
||||||
|
NavButtonList,
|
||||||
|
NavButtonLocal,
|
||||||
|
NavButtonMention,
|
||||||
|
NavButtonMoreMenu,
|
||||||
|
NavButtonNotification,
|
||||||
|
NavButtonSearch,
|
||||||
|
} from '#components'
|
||||||
|
|
||||||
|
import { STORAGE_KEY_BOTTOM_NAV_BUTTONS } from '~/constants'
|
||||||
|
|
||||||
|
interface NavButton {
|
||||||
|
name: string
|
||||||
|
component: Component
|
||||||
|
}
|
||||||
|
|
||||||
|
const navButtons: NavButton[] = [
|
||||||
|
{ name: 'home', component: NavButtonHome },
|
||||||
|
{ name: 'search', component: NavButtonSearch },
|
||||||
|
{ name: 'notification', component: NavButtonNotification },
|
||||||
|
{ name: 'mention', component: NavButtonMention },
|
||||||
|
{ name: 'favorite', component: NavButtonFavorite },
|
||||||
|
{ name: 'bookmark', component: NavButtonBookmark },
|
||||||
|
{ name: 'compose', component: NavButtonCompose },
|
||||||
|
{ name: 'explore', component: NavButtonExplore },
|
||||||
|
{ name: 'local', component: NavButtonLocal },
|
||||||
|
{ name: 'federated', component: NavButtonFederated },
|
||||||
|
{ name: 'list', component: NavButtonList },
|
||||||
|
{ name: 'hashtag', component: NavButtonHashtag },
|
||||||
|
{ name: 'moreMenu', component: NavButtonMoreMenu },
|
||||||
|
]
|
||||||
|
|
||||||
|
const defaultSelectedNavButtonNames: NavButtonName[] = currentUser.value
|
||||||
|
? ['home', 'search', 'notification', 'mention', 'moreMenu']
|
||||||
|
: ['explore', 'local', 'federated', 'moreMenu']
|
||||||
|
const selectedNavButtonNames = useLocalStorage<NavButtonName[]>(STORAGE_KEY_BOTTOM_NAV_BUTTONS, defaultSelectedNavButtonNames)
|
||||||
|
|
||||||
|
const selectedNavButtons = computed(() => selectedNavButtonNames.value.map(name => navButtons.find(navButton => navButton.name === name)))
|
||||||
|
|
||||||
|
// only one icon can be lit up at the same time
|
||||||
|
const moreMenuVisible = ref(false)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<!-- This weird styles above are used for scroll locking, don't change it unless you know exactly what you're doing. -->
|
||||||
|
<nav
|
||||||
|
h-14 border="t base" flex flex-row text-xl
|
||||||
|
of-y-scroll scrollbar-hide overscroll-none
|
||||||
|
class="after-content-empty after:(h-[calc(100%+0.5px)] w-0.1px pointer-events-none)"
|
||||||
|
>
|
||||||
|
<Component :is="navButton!.component" v-for="navButton in selectedNavButtons" :key="navButton!.name" :active-class="moreMenuVisible ? '' : 'text-primary'" />
|
||||||
|
</nav>
|
||||||
|
</template>
|
|
@ -1,22 +1,27 @@
|
||||||
<script lang="ts" setup>
|
<script setup lang="ts">
|
||||||
let { modelValue } = $defineModels<{
|
import { invoke } from '@vueuse/core'
|
||||||
modelValue: boolean
|
|
||||||
}>()
|
const modelValue = defineModel<boolean>({ required: true })
|
||||||
const colorMode = useColorMode()
|
const colorMode = useColorMode()
|
||||||
|
|
||||||
const userSettings = useUserSettings()
|
const userSettings = useUserSettings()
|
||||||
|
|
||||||
|
const drawerEl = ref<HTMLDivElement>()
|
||||||
|
|
||||||
function toggleVisible() {
|
function toggleVisible() {
|
||||||
modelValue = !modelValue
|
modelValue.value = !modelValue.value
|
||||||
}
|
}
|
||||||
|
|
||||||
const buttonEl = ref<HTMLDivElement>()
|
const buttonEl = ref<HTMLDivElement>()
|
||||||
/** Close the drop-down menu if the mouse click is not on the drop-down menu button when the drop-down menu is opened */
|
/**
|
||||||
|
* Close the drop-down menu if the mouse click is not on the drop-down menu button when the drop-down menu is opened
|
||||||
|
* @param mouse
|
||||||
|
*/
|
||||||
function clickEvent(mouse: MouseEvent) {
|
function clickEvent(mouse: MouseEvent) {
|
||||||
if (mouse.target && !buttonEl.value?.children[0].contains(mouse.target as any)) {
|
if (mouse.target && !buttonEl.value?.children[0].contains(mouse.target as any)) {
|
||||||
if (modelValue) {
|
if (modelValue.value) {
|
||||||
document.removeEventListener('click', clickEvent)
|
document.removeEventListener('click', clickEvent)
|
||||||
modelValue = false
|
modelValue.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +30,7 @@ function toggleDark() {
|
||||||
colorMode.preference = colorMode.value === 'dark' ? 'light' : 'dark'
|
colorMode.preference = colorMode.value === 'dark' ? 'light' : 'dark'
|
||||||
}
|
}
|
||||||
|
|
||||||
watch($$(modelValue), (val) => {
|
watch(modelValue, (val) => {
|
||||||
if (val && typeof document !== 'undefined')
|
if (val && typeof document !== 'undefined')
|
||||||
document.addEventListener('click', clickEvent)
|
document.addEventListener('click', clickEvent)
|
||||||
})
|
})
|
||||||
|
@ -33,6 +38,80 @@ watch($$(modelValue), (val) => {
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
document.removeEventListener('click', clickEvent)
|
document.removeEventListener('click', clickEvent)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Pull down to close
|
||||||
|
const { dragging, dragDistance } = invoke(() => {
|
||||||
|
const triggerDistance = 120
|
||||||
|
|
||||||
|
let scrollTop = 0
|
||||||
|
let beforeTouchPointY = 0
|
||||||
|
|
||||||
|
const dragDistance = ref(0)
|
||||||
|
const dragging = ref(false)
|
||||||
|
|
||||||
|
useEventListener(drawerEl, 'scroll', (e: Event) => {
|
||||||
|
scrollTop = (e.target as HTMLDivElement).scrollTop
|
||||||
|
|
||||||
|
// Prevent the page from scrolling when the drawer is being dragged.
|
||||||
|
if (dragDistance.value > 0)
|
||||||
|
(e.target as HTMLDivElement).scrollTop = 0
|
||||||
|
}, { passive: true })
|
||||||
|
|
||||||
|
useEventListener(drawerEl, 'touchstart', (e: TouchEvent) => {
|
||||||
|
if (!modelValue.value)
|
||||||
|
return
|
||||||
|
|
||||||
|
beforeTouchPointY = e.touches[0].pageY
|
||||||
|
dragDistance.value = 0
|
||||||
|
}, { passive: true })
|
||||||
|
|
||||||
|
useEventListener(drawerEl, 'touchmove', (e: TouchEvent) => {
|
||||||
|
if (!modelValue.value)
|
||||||
|
return
|
||||||
|
|
||||||
|
// Do not move the entire drawer when its contents are not scrolled to the top.
|
||||||
|
if (scrollTop > 0 && dragDistance.value <= 0) {
|
||||||
|
dragging.value = false
|
||||||
|
beforeTouchPointY = e.touches[0].pageY
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const { pageY } = e.touches[0]
|
||||||
|
|
||||||
|
// Calculate the drag distance.
|
||||||
|
dragDistance.value += pageY - beforeTouchPointY
|
||||||
|
if (dragDistance.value < 0)
|
||||||
|
dragDistance.value = 0
|
||||||
|
beforeTouchPointY = pageY
|
||||||
|
|
||||||
|
// Marked as dragging.
|
||||||
|
if (dragDistance.value > 1)
|
||||||
|
dragging.value = true
|
||||||
|
|
||||||
|
// Prevent the page from scrolling when the drawer is being dragged.
|
||||||
|
if (dragDistance.value > 0) {
|
||||||
|
if (e?.cancelable && e?.preventDefault)
|
||||||
|
e.preventDefault()
|
||||||
|
e?.stopPropagation()
|
||||||
|
}
|
||||||
|
}, { passive: true })
|
||||||
|
|
||||||
|
useEventListener(drawerEl, 'touchend', () => {
|
||||||
|
if (!modelValue.value)
|
||||||
|
return
|
||||||
|
|
||||||
|
if (dragDistance.value >= triggerDistance)
|
||||||
|
modelValue.value = false
|
||||||
|
|
||||||
|
dragging.value = false
|
||||||
|
// code
|
||||||
|
}, { passive: true })
|
||||||
|
|
||||||
|
return {
|
||||||
|
dragDistance,
|
||||||
|
dragging,
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -41,12 +120,12 @@ onBeforeUnmount(() => {
|
||||||
|
|
||||||
<!-- Drawer -->
|
<!-- Drawer -->
|
||||||
<Transition
|
<Transition
|
||||||
enter-active-class="transition duration-250 ease-out children:(transition duration-250 ease-out)"
|
enter-active-class="transition duration-250 ease-out"
|
||||||
enter-from-class="opacity-0 children:(transform translate-y-full)"
|
enter-from-class="opacity-0 children:(translate-y-full)"
|
||||||
enter-to-class="opacity-100 children:(transform translate-y-0)"
|
enter-to-class="opacity-100 children:(translate-y-0)"
|
||||||
leave-active-class="transition duration-250 ease-in children:(transition duration-250 ease-in)"
|
leave-active-class="transition duration-250 ease-in"
|
||||||
leave-from-class="opacity-100 children:(transform translate-y-0)"
|
leave-from-class="opacity-100 children:(translate-y-0)"
|
||||||
leave-to-class="opacity-0 children:(transform translate-y-full)"
|
leave-to-class="opacity-0 children:(translate-y-full)"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-show="modelValue"
|
v-show="modelValue"
|
||||||
|
@ -58,10 +137,19 @@ onBeforeUnmount(() => {
|
||||||
<!-- corresponding to issue: #106, so please don't remove it. -->
|
<!-- corresponding to issue: #106, so please don't remove it. -->
|
||||||
<div absolute inset-0 opacity-0 h="[calc(100vh+0.5px)]" />
|
<div absolute inset-0 opacity-0 h="[calc(100vh+0.5px)]" />
|
||||||
<div
|
<div
|
||||||
|
ref="drawerEl"
|
||||||
|
:style="{
|
||||||
|
transform: dragging ? `translateY(${dragDistance}px)` : '',
|
||||||
|
}"
|
||||||
|
:class="{
|
||||||
|
'duration-0': dragging,
|
||||||
|
'duration-250': !dragging,
|
||||||
|
'backdrop-blur-md': !getPreferences(userSettings, 'optimizeForLowPerformanceDevice'),
|
||||||
|
}"
|
||||||
|
transition="transform ease-in"
|
||||||
flex-1 min-w-48 py-6 mb="-1px"
|
flex-1 min-w-48 py-6 mb="-1px"
|
||||||
of-y-auto scrollbar-hide overscroll-none max-h="[calc(100vh-200px)]"
|
of-y-auto scrollbar-hide overscroll-none max-h="[calc(100vh-200px)]"
|
||||||
rounded-t-lg bg="white/85 dark:neutral-900/85" backdrop-filter backdrop-blur-md
|
rounded-t-lg bg="white/85 dark:neutral-900/85" backdrop-filter
|
||||||
border-t-1 border-base
|
border-t-1 border-base
|
||||||
>
|
>
|
||||||
<!-- Nav -->
|
<!-- Nav -->
|
|
@ -28,6 +28,9 @@ function toggleDark() {
|
||||||
@click="togglePreferences('zenMode')"
|
@click="togglePreferences('zenMode')"
|
||||||
/>
|
/>
|
||||||
</CommonTooltip>
|
</CommonTooltip>
|
||||||
|
<CommonTooltip :content="$t('magic_keys.dialog_header')">
|
||||||
|
<button flex i-ri:keyboard-box-line dark-i-ri:keyboard-box-line text-lg :aria-label="$t('magic_keys.dialog_header')" @click="toggleKeyboardShortcuts" />
|
||||||
|
</CommonTooltip>
|
||||||
<CommonTooltip :content="$t('settings.about.sponsor_action')">
|
<CommonTooltip :content="$t('settings.about.sponsor_action')">
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
flex
|
flex
|
23
app/components/nav/NavLogo.vue
Normal file
23
app/components/nav/NavLogo.vue
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<span shrink-0 aspect="1/1" sm:h-8 xl:h-10 class="rtl-flip">
|
||||||
|
<!-- <svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg" w-full
|
||||||
|
aspect="1/1" sm:h-8 xl:h-10 sm:w-8 xl:w-10 viewBox="0 0 250 250" fill="none"
|
||||||
|
> -->
|
||||||
|
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><defs><mask id="ipTEgg0"><g fill="none" stroke="#fff" stroke-width="4"><circle cx="24" cy="24" r="10" fill="#555555" stroke-linecap="round" stroke-linejoin="round" /><path d="M44 24c0 2.633-.508 5.146-1.433 7.448c-.936 2.331-4.129.071-7.346 3.521c-3.216 3.45-.71 6.267-3.204 7.36A19.9 19.9 0 0 1 24 44C12.954 44 4 35.046 4 24S12.954 4 24 4s20 8.954 20 20Z" /><path stroke-linecap="round" d="M20 25s.21 1.21 1 2s2 1 2 1" /></g></mask></defs><path fill="#ff8d00" d="M0 0h48v48H0z" mask="url(#ipTEgg0)" /></svg>
|
||||||
|
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
svg path.wood {
|
||||||
|
fill: var(--c-primary);
|
||||||
|
}
|
||||||
|
svg path.body {
|
||||||
|
fill: var(--c-text-secondary);
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -1,18 +1,47 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const { command } = defineProps<{
|
import { STORAGE_KEY_LAST_ACCESSED_EXPLORE_ROUTE, STORAGE_KEY_LAST_ACCESSED_NOTIFICATION_ROUTE } from '~/constants'
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
command?: boolean
|
command?: boolean
|
||||||
}>()
|
}>()
|
||||||
const { notifications } = useNotifications()
|
const { notifications } = useNotifications()
|
||||||
|
const useStarFavoriteIcon = usePreferences('useStarFavoriteIcon')
|
||||||
|
const lastAccessedNotificationRoute = useLocalStorage(STORAGE_KEY_LAST_ACCESSED_NOTIFICATION_ROUTE, '')
|
||||||
|
const lastAccessedExploreRoute = useLocalStorage(STORAGE_KEY_LAST_ACCESSED_EXPLORE_ROUTE, '')
|
||||||
|
|
||||||
|
const notificationsLink = computed(() => {
|
||||||
|
const hydrated = isHydrated.value
|
||||||
|
const user = currentUser.value
|
||||||
|
const lastRoute = lastAccessedNotificationRoute.value
|
||||||
|
if (!hydrated || !user || !lastRoute) {
|
||||||
|
return '/notifications'
|
||||||
|
}
|
||||||
|
|
||||||
|
return `/notifications/${lastRoute}`
|
||||||
|
})
|
||||||
|
const exploreLink = computed(() => {
|
||||||
|
const hydrated = isHydrated.value
|
||||||
|
const server = currentServer.value
|
||||||
|
let lastRoute = lastAccessedExploreRoute.value
|
||||||
|
if (!hydrated) {
|
||||||
|
return '/explore'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lastRoute.length) {
|
||||||
|
lastRoute = `/${lastRoute}`
|
||||||
|
}
|
||||||
|
|
||||||
|
return server ? `/${server}/explore${lastRoute}` : `/explore${lastRoute}`
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<nav sm:px3 flex="~ col gap2" shrink text-size-base leading-normal md:text-lg h-full mt-1 overflow-y-auto>
|
<nav sm:px3 flex="~ col gap2" shrink text-size-base leading-normal md:text-lg h-full mt-1 overflow-y-auto>
|
||||||
<SearchWidget lg:ms-1 lg:me-5 hidden xl:block />
|
<NavSideItem :text="$t('nav.search')" to="/search" icon="i-ri:search-line" xl:hidden :command="command" />
|
||||||
<NavSideItem :text="$t('nav.search')" :to="isHydrated ? `/${currentServer}/explore` : '/explore'" icon="i-ri:search-line" hidden sm:block xl:hidden :command="command" />
|
|
||||||
|
|
||||||
<div class="spacer" shrink hidden sm:block />
|
<div class="spacer" shrink xl:hidden />
|
||||||
<NavSideItem :text="$t('nav.home')" to="/home" icon="i-ri:home-5-line" user-only :command="command" />
|
<NavSideItem :text="$t('nav.home')" to="/home" icon="i-ri:home-5-line" user-only :command="command" />
|
||||||
<NavSideItem :text="$t('nav.notifications')" to="/notifications" icon="i-ri:notification-4-line" user-only :command="command">
|
<NavSideItem :text="$t('nav.notifications')" :to="notificationsLink" icon="i-ri:notification-4-line" user-only :command="command">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<div flex relative>
|
<div flex relative>
|
||||||
<div class="i-ri:notification-4-line" text-xl />
|
<div class="i-ri:notification-4-line" text-xl />
|
||||||
|
@ -23,15 +52,18 @@ const { notifications } = useNotifications()
|
||||||
</template>
|
</template>
|
||||||
</NavSideItem>
|
</NavSideItem>
|
||||||
<NavSideItem :text="$t('nav.conversations')" to="/conversations" icon="i-ri:at-line" user-only :command="command" />
|
<NavSideItem :text="$t('nav.conversations')" to="/conversations" icon="i-ri:at-line" user-only :command="command" />
|
||||||
<NavSideItem :text="$t('nav.favourites')" to="/favourites" icon="i-ri:heart-3-line" user-only :command="command" />
|
<NavSideItem :text="$t('nav.favourites')" to="/favourites" :icon="useStarFavoriteIcon ? 'i-ri:star-line' : 'i-ri:heart-3-line'" user-only :command="command" />
|
||||||
<NavSideItem :text="$t('nav.bookmarks')" to="/bookmarks" icon="i-ri:bookmark-line" user-only :command="command" />
|
<NavSideItem :text="$t('nav.bookmarks')" to="/bookmarks" icon="i-ri:bookmark-line" user-only :command="command" />
|
||||||
|
|
||||||
|
<div class="spacer" shrink hidden sm:block />
|
||||||
<NavSideItem :text="$t('action.compose')" to="/compose" icon="i-ri:quill-pen-line" user-only :command="command" />
|
<NavSideItem :text="$t('action.compose')" to="/compose" icon="i-ri:quill-pen-line" user-only :command="command" />
|
||||||
|
|
||||||
<div class="spacer" shrink hidden sm:block />
|
<div class="spacer" shrink hidden sm:block />
|
||||||
<NavSideItem :text="$t('nav.explore')" :to="isHydrated ? `/${currentServer}/explore` : '/explore'" icon="i-ri:hashtag" :command="command" xs:hidden sm:hidden xl:block />
|
<NavSideItem :text="$t('nav.explore')" :to="exploreLink" icon="i-ri:compass-3-line" :command="command" />
|
||||||
<NavSideItem :text="$t('nav.local')" :to="isHydrated ? `/${currentServer}/public/local` : '/public/local'" icon="i-ri:group-2-line " :command="command" />
|
<NavSideItem :text="$t('nav.local')" :to="isHydrated ? `/${currentServer}/public/local` : '/public/local'" icon="i-ri:group-2-line " :command="command" />
|
||||||
<NavSideItem :text="$t('nav.federated')" :to="isHydrated ? `/${currentServer}/public` : '/public'" icon="i-ri:earth-line" :command="command" />
|
<NavSideItem :text="$t('nav.federated')" :to="isHydrated ? `/${currentServer}/public` : '/public'" icon="i-ri:earth-line" :command="command" />
|
||||||
<NavSideItem :text="$t('nav.lists')" :to="isHydrated ? `/${currentServer}/lists` : '/lists'" icon="i-ri:list-check" user-only :command="command" />
|
<NavSideItem :text="$t('nav.lists')" :to="isHydrated ? `/${currentServer}/lists` : '/lists'" icon="i-ri:list-check" user-only :command="command" />
|
||||||
|
<NavSideItem :text="$t('nav.hashtags')" to="/hashtags" icon="i-ri:hashtag" user-only :command="command" />
|
||||||
|
|
||||||
<div class="spacer" shrink hidden sm:block />
|
<div class="spacer" shrink hidden sm:block />
|
||||||
<NavSideItem :text="$t('nav.settings')" to="/settings" icon="i-ri:settings-3-line" :command="command" />
|
<NavSideItem :text="$t('nav.settings')" to="/settings" icon="i-ri:settings-3-line" :command="command" />
|
||||||
|
@ -42,7 +74,7 @@ const { notifications } = useNotifications()
|
||||||
.spacer {
|
.spacer {
|
||||||
margin-top: 0.5em;
|
margin-top: 0.5em;
|
||||||
}
|
}
|
||||||
@media screen and ( max-height: 820px ) {
|
@media screen and ( max-height: 920px ) and ( min-width: 640px ) {
|
||||||
.spacer {
|
.spacer {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
|
@ -1,17 +1,15 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const props = withDefaults(defineProps<{
|
const { text, icon, to, userOnly = false, command } = defineProps<{
|
||||||
text?: string
|
text?: string
|
||||||
icon: string
|
icon: string
|
||||||
to: string | Record<string, string>
|
to: string | Record<string, string>
|
||||||
userOnly?: boolean
|
userOnly?: boolean
|
||||||
command?: boolean
|
command?: boolean
|
||||||
}>(), {
|
}>()
|
||||||
userOnly: false,
|
|
||||||
})
|
|
||||||
|
|
||||||
defineSlots<{
|
defineSlots<{
|
||||||
icon: {}
|
icon: (props: object) => void
|
||||||
default: {}
|
default: (props: object) => void
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
@ -19,28 +17,28 @@ const router = useRouter()
|
||||||
useCommand({
|
useCommand({
|
||||||
scope: 'Navigation',
|
scope: 'Navigation',
|
||||||
|
|
||||||
name: () => props.text ?? (typeof props.to === 'string' ? props.to as string : props.to.name),
|
name: () => text ?? (typeof to === 'string' ? to as string : to.name),
|
||||||
icon: () => props.icon,
|
icon: () => icon,
|
||||||
visible: () => props.command,
|
visible: () => command,
|
||||||
|
|
||||||
onActivate() {
|
onActivate() {
|
||||||
router.push(props.to)
|
router.push(to)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
let activeClass = $ref('text-primary')
|
const activeClass = ref('text-primary')
|
||||||
onHydrated(async () => {
|
onHydrated(async () => {
|
||||||
// TODO: force NuxtLink to reevaluate, we now we are in this route though, so we should force it to active
|
// TODO: force NuxtLink to reevaluate, we now we are in this route though, so we should force it to active
|
||||||
// we don't have currentServer defined until later
|
// we don't have currentServer defined until later
|
||||||
activeClass = ''
|
activeClass.value = ''
|
||||||
await nextTick()
|
await nextTick()
|
||||||
activeClass = 'text-primary'
|
activeClass.value = 'text-primary'
|
||||||
})
|
})
|
||||||
|
|
||||||
// Optimize rendering for the common case of being logged in, only show visual feedback for disabled user-only items
|
// Optimize rendering for the common case of being logged in, only show visual feedback for disabled user-only items
|
||||||
// when we know there is no user.
|
// when we know there is no user.
|
||||||
const noUserDisable = computed(() => !isHydrated.value || (props.userOnly && !currentUser.value))
|
const noUserDisable = computed(() => !isHydrated.value || (userOnly && !currentUser.value))
|
||||||
const noUserVisual = computed(() => isHydrated.value && props.userOnly && !currentUser.value)
|
const noUserVisual = computed(() => isHydrated.value && userOnly && !currentUser.value)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -57,11 +55,21 @@ const noUserVisual = computed(() => isHydrated.value && props.userOnly && !curre
|
||||||
<div
|
<div
|
||||||
class="item"
|
class="item"
|
||||||
flex items-center gap4
|
flex items-center gap4
|
||||||
|
xl="ml0 mr5 px5 w-auto"
|
||||||
|
:class="isSmallScreen
|
||||||
|
? `
|
||||||
|
w-full
|
||||||
|
px5 sm:mxa
|
||||||
|
transition-colors duration-200 transform
|
||||||
|
hover-bg-gray-100 hover-dark:(bg-gray-700 text-white)
|
||||||
|
` : `
|
||||||
w-fit rounded-3
|
w-fit rounded-3
|
||||||
px2 mx3 sm:mxa
|
px2 mx3 sm:mxa
|
||||||
xl="ml0 mr5 px5 w-auto"
|
|
||||||
transition-100
|
transition-100
|
||||||
elk-group-hover="bg-active" group-focus-visible:ring="2 current"
|
elk-group-hover-bg-active
|
||||||
|
group-focus-visible:ring-2
|
||||||
|
group-focus-visible:ring-current
|
||||||
|
`"
|
||||||
>
|
>
|
||||||
<slot name="icon">
|
<slot name="icon">
|
||||||
<div :class="icon" text-xl />
|
<div :class="icon" text-xl />
|
||||||
|
@ -79,13 +87,19 @@ const noUserVisual = computed(() => isHydrated.value && props.userOnly && !curre
|
||||||
padding-top: 0.5rem;
|
padding-top: 0.5rem;
|
||||||
padding-bottom: 0.5rem;
|
padding-bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
@media screen and ( max-height: 820px ) {
|
@media screen and ( max-height: 820px ) and ( min-width: 1280px ) {
|
||||||
.item {
|
.item {
|
||||||
padding-top: 0.25rem;
|
padding-top: 0.25rem;
|
||||||
padding-bottom: 0.25rem;
|
padding-bottom: 0.25rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@media screen and ( max-height: 720px ) {
|
@media screen and ( max-height: 780px ) and ( min-width: 640px ) {
|
||||||
|
.item {
|
||||||
|
padding-top: 0.35rem;
|
||||||
|
padding-bottom: 0.35rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media screen and ( max-height: 780px ) and ( min-width: 1280px ) {
|
||||||
.item {
|
.item {
|
||||||
padding-top: 0.05rem;
|
padding-top: 0.05rem;
|
||||||
padding-bottom: 0.05rem;
|
padding-bottom: 0.05rem;
|
|
@ -29,25 +29,20 @@ router.afterEach(() => {
|
||||||
@click.prevent="onClickLogo"
|
@click.prevent="onClickLogo"
|
||||||
>
|
>
|
||||||
<NavLogo shrink-0 aspect="1/1" sm:h-8 xl:h-10 class="rtl-flip" />
|
<NavLogo shrink-0 aspect="1/1" sm:h-8 xl:h-10 class="rtl-flip" />
|
||||||
<div v-show="isHydrated" hidden xl:block text-secondary>
|
<div v-show="isHydrated" hidden xl:block>
|
||||||
{{ $t('app_name') }} <sup text-sm italic mt-1>{{ env === 'release' ? 'alpha' : env }}</sup>
|
<span pr-1>{{ $t('app_name') }}</span>
|
||||||
|
<sup text-sm italic mt-1>{{ env === 'release' ? 'alpha' : env }}</sup>
|
||||||
</div>
|
</div>
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<div
|
<div hidden xl:flex items-center me-6 mt-2 gap-1>
|
||||||
hidden xl:flex items-center me-8 mt-2 gap-1
|
<CommonTooltip :content="$t('nav.back')" :distance="0">
|
||||||
>
|
<button
|
||||||
<CommonTooltip :content="$t('nav.back')">
|
type="button"
|
||||||
<NuxtLink
|
|
||||||
:aria-label="$t('nav.back')"
|
:aria-label="$t('nav.back')"
|
||||||
:class="{ 'pointer-events-none op0': !back || back === '/', 'xl:flex': $route.name !== 'tag' }"
|
btn-text p-3 :class="{ 'pointer-events-none op0': !back || back === '/', 'xl:flex': $route.name !== 'tag' }"
|
||||||
@click="$router.go(-1)"
|
@click="$router.go(-1)"
|
||||||
>
|
>
|
||||||
<div text-xl i-ri:arrow-left-line class="rtl-flip" btn-text />
|
<div text-xl i-ri:arrow-left-line class="rtl-flip" />
|
||||||
</NuxtLink>
|
|
||||||
</CommonTooltip>
|
|
||||||
<CommonTooltip :content="$t('action.compose')">
|
|
||||||
<button :aria-label="$t('action.compose')" btn-action-icon @click="openPublishDialog('compose')">
|
|
||||||
<div text-xl i-ri:quill-pen-line user-only class="rtl-flip" btn-text />
|
|
||||||
</button>
|
</button>
|
||||||
</CommonTooltip>
|
</CommonTooltip>
|
||||||
</div>
|
</div>
|
|
@ -1,4 +1,4 @@
|
||||||
<script setup>
|
<script setup lang="ts">
|
||||||
const { busy, oauth, singleInstanceServer } = useSignIn()
|
const { busy, oauth, singleInstanceServer } = useSignIn()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -34,7 +34,13 @@ const { busy, oauth, singleInstanceServer } = useSignIn()
|
||||||
<strong>{{ currentServer }}</strong>
|
<strong>{{ currentServer }}</strong>
|
||||||
</i18n-t>
|
</i18n-t>
|
||||||
</button>
|
</button>
|
||||||
<button v-else btn-solid text-sm px-2 py-1 text-center xl:hidden @click="openSigninDialog()">
|
<button
|
||||||
|
v-else
|
||||||
|
flex="~ row"
|
||||||
|
gap-x-1 items-center justify-center btn-solid text-sm px-2 py-1 xl:hidden
|
||||||
|
@click="openSigninDialog()"
|
||||||
|
>
|
||||||
|
<span aria-hidden="true" block i-ri:login-circle-line class="rtl-flip" />
|
||||||
{{ $t('action.sign_in') }}
|
{{ $t('action.sign_in') }}
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
11
app/components/nav/button/Bookmark.vue
Normal file
11
app/components/nav/button/Bookmark.vue
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
defineProps<{
|
||||||
|
activeClass: string
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<NuxtLink to="/bookmarks" :aria-label="$t('nav.bookmarks')" :active-class="activeClass" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||||
|
<div i-ri:bookmark-line />
|
||||||
|
</NuxtLink>
|
||||||
|
</template>
|
11
app/components/nav/button/Compose.vue
Normal file
11
app/components/nav/button/Compose.vue
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
defineProps<{
|
||||||
|
activeClass: string
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<NuxtLink to="/compose" :aria-label="$t('nav.favourites')" :active-class="activeClass" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||||
|
<div i-ri:quill-pen-line />
|
||||||
|
</NuxtLink>
|
||||||
|
</template>
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue