Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 132x 132x 132x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 10x 10x 10x 10x 10x 10x 1x 60x 60x 60x 60x 60x 60x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 11x 11x 11x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 13x 13x 13x 13x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 34x 34x 34x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 4x 4x 4x 4x 4x 4x 4x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 339x 339x 339x 339x 339x 151x 151x 151x 151x 499x 499x 499x 499x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 135x 135x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 324x 324x 324x 324x 151x 151x 160x 160x 160x 160x 160x 160x 160x 160x 151x 151x 18x 18x 18x 18x 18x 151x 151x 151x 151x 151x 84x 75x 75x 75x 75x 75x 84x 9x 9x 151x 151x 151x 151x 151x 151x 69x 69x 69x 69x 5x 5x 3x 5x 1x 1x 1x 1x 1x 1x 5x 69x 65x 65x 65x 2x 2x 2x 2x 2x 151x 151x 151x 151x 155x 155x 155x 155x 155x 155x 155x 155x 153x 153x 155x 154x 69x 155x 84x 84x 155x 155x 155x 155x 151x 151x 151x 151x 5x 5x 5x 5x 5x 5x 5x 151x 151x 4x 4x 4x 4x 1x 4x 3x 3x 4x 151x 151x 151x 151x 14x 14x 12x 12x 12x 13x 3x 3x 3x 3x 13x 7x 7x 7x 7x 7x 7x 7x 6x 1x 1x 1x 1x 151x 151x 151x 151x 151x 151x 164x 164x 164x 164x 164x 164x 162x 164x 164x 164x 2x 2x 151x 151x 151x 151x 151x 151x 151x 197x 197x 197x 197x 40x 40x 40x 40x 40x 40x 40x 40x 40x 197x 151x 151x 134x 151x 151x 147x 147x 147x 147x 147x 147x 147x 147x 147x 147x 147x 147x 147x 147x 147x 147x 147x 147x 147x 147x 147x 131x 131x 147x 147x 147x 147x 147x 147x 147x 147x 151x 151x 151x 151x 151x 151x 151x 17x 17x 17x 17x 17x 151x 151x 151x 129x 129x 129x 1042x 142x 142x 1042x 129x 151x 151x 151x 151x 151x 151x 173x 93x 93x 114x 114x 76x 151x 151x 151x 151x 44x 44x 44x 44x 1x 1x 44x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 9x 9x 44x 44x 44x 44x 44x 44x 44x 44x 44x 44x 2x 2x 44x 44x 44x 151x 151x 151x 151x 31x 30x 31x 3x 3x 3x 3x 3x 3x 31x 6x 6x 6x 6x 6x 6x 31x 2x 2x 2x 2x 2x 2x 31x 1x 1x 1x 1x 1x 1x 30x 151x 151x 151x 151x 164x 164x 10x 10x 164x 151x 151x 151x 151x 151x 151x 151x 964x 964x 964x 964x 964x 964x 964x 151x 151x 151x 151x 151x 151x 162x 151x 151x 151x 162x 151x 151x 151x 151x 151x 162x 162x 162x 162x 162x 162x 151x 151x 151x 151x 486x 486x 486x 486x 43x 43x 43x 151x 151x 162x 162x 1027x 1004x 1004x 1004x 162x 151x 151x 151x 3x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 19x 19x 19x 19x 19x 19x 19x 151x 151x 151x 21x 21x 21x 21x 21x 151x 151x 151x 26x 26x 151x 151x 151x 151x 151x 1x 1x 1x 1x 1x 1x 1x 1x 151x 151x 151x 151x 97x 97x 97x 97x 97x 151x 151x 151x 151x 151x 151x 151x 151x 29x 29x 151x 151x 151x 151x 151x 151x 61x 61x 61x 61x 151x 151x 151x 151x 76x 76x 52x 52x 52x 52x 52x 52x 52x 76x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 153x 153x 153x 153x 153x 153x 153x 153x 153x 151x 151x 208x 208x 208x 31x 31x 31x 31x 208x 153x 153x 153x 153x 153x 153x 153x 153x 153x 153x 208x 151x 151x 151x 151x 254x 254x 158x 158x 158x 158x 86x 86x 151x 151x 151x 151x 50x 50x 50x 50x 50x 50x 50x 50x 151x 151x 151x 151x 50x 50x 50x 50x 50x 50x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 12x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 1498x 1498x 1498x 1498x 1498x 1498x 151x 151x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 151x 151x 151x 151x 151x 151x 151x 151x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 1x 1x 1x 5x 5x 5x 5x 5x 5x 5x 1x 1x 5x 5x 5x 151x 151x 151x 151x 151x 151x 151x 154x 75x 75x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 162x 162x 162x 162x 30x 30x 30x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 162x 188x 188x 162x 151x 151x 151x 151x 151x 284x 284x 184x 184x 184x 184x 1133x 184x 284x 284x 1111x 284x 284x 284x 284x 99x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 445x 445x 151x 151x 12x 12x 12x 67x 18x 18x 67x 12x 151x 151x 12x 12x 12x 67x 67x 18x 67x 67x 67x 18x 18x 67x 12x 12x 12x 2x 2x 2x 12x 12x 151x 151x 1x 1x 1x 7x 1x 7x 1x 1x 1x 151x 151x 151x 151x 151x 443x 13x 33x 12x 443x 12x 12x 443x 12x 12x 151x 151x 151x 151x 151x 151x 12x 12x 12x 12x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 302x 302x 2x 2x 2x 2x 302x 302x 302x 302x 302x 302x 302x 302x 302x 302x 302x 2x 2x 2x 2x 302x 302x 302x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 445x 445x 445x 445x 151x 151x 59x 59x 59x 331x 331x 331x 331x 331x 262x 262x 331x 59x 151x 151x 61x 61x 61x 343x 343x 343x 274x 274x 343x 229x 229x 343x 61x 151x 151x 3x 3x 3x 18x 18x 18x 18x 6x 6x 3x 151x 151x 151x 151x 443x 83x 433x 59x 443x 59x 59x 443x 59x 59x 151x 151x 151x 151x 61x 61x 61x 61x 151x 151x 151x 151x 151x 139x 28x 1x 1x 1x 3x 3x 3x 3x 3x 151x 151x 151x 151x 151x 73x 73x 73x 151x 151x 151x 151x 151x 151x 151x 151x 148x 151x 151x 151x 151x 151x 87x 87x 87x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 151x 1x 1x | <template>
<!-- Match detail modal: overlays the tournament page when a row or bracket
cell is clicked. ModalOverlay owns the close affordances -- pinned
button, Escape, backdrop -- plus scroll lock and focus handling. -->
<ModalOverlay
v-if="selectedMatchId"
label="Match details"
max-width="max-w-6xl"
close-label="Close match details"
@close="handleBackFromMatchDetail"
>
<MatchDetailView
:matchId="selectedMatchId"
back-label="Back to tournament"
@back="handleBackFromMatchDetail"
/>
</ModalOverlay>
<div
:class="
viewMode === 'bracket' || viewMode === 'standings'
? 'max-w-7xl mx-auto'
: '-mx-2 sm:mx-auto max-w-5xl'
"
>
<!-- Loading -->
<div v-if="loading" class="flex justify-center py-12">
<div
class="animate-spin rounded-full h-8 w-8 border-b-2 border-brand-600"
></div>
</div>
<!-- Error -->
<div
v-else-if="error"
class="bg-red-50 border border-red-200 rounded-md p-4"
>
<p class="text-red-800">{{ error }}</p>
</div>
<template v-else>
<!-- Season selector: always visible so the user can switch seasons even
when the selected season has no tournaments. -->
<div v-if="seasons.length > 0" class="mb-3 sm:mb-6 max-w-xs">
<label
for="tournament-season"
class="block text-sm font-medium text-fg mb-1"
>Season</label
>
<select
id="tournament-season"
v-model="selectedSeasonId"
data-testid="tournament-season-select"
class="block w-full px-3 py-2 border border-line bg-card text-fg rounded-md shadow-sm focus:outline-none focus:ring-brand-500 focus:border-brand-500 sm:text-sm"
>
<option v-for="season in seasons" :key="season.id" :value="season.id">
{{ season.name }} ({{ formatSeasonDates(season) }})
</option>
</select>
</div>
<!-- No tournaments in the selected season -->
<div
v-if="tournaments.length === 0"
class="text-center py-16 text-fg-muted"
>
<div class="text-5xl mb-4">๐</div>
<p class="text-lg font-medium text-fg">No tournaments this season</p>
<p class="text-sm mt-1">
Try another season, or check back soon for upcoming events.
</p>
<p
v-if="indexNotice"
class="text-sm mt-3"
data-testid="tournament-index-notice"
>
{{ indexNotice }}
</p>
</div>
<!-- Season index (SB-1767): one card per tournament. -->
<TournamentIndex
v-else-if="selectedId == null"
:tournaments="tournaments"
:notice="indexNotice"
@open="openTournament"
/>
<template v-else>
<!-- Back to the index, and a compact switcher between this season's
tournaments when there is more than one. -->
<div class="mb-3 sm:mb-6 flex items-center gap-2 min-w-0">
<button
type="button"
class="shrink-0 px-3 py-2 rounded-full text-sm font-medium text-brand-600 dark:text-brand-300 hover:text-brand-800 dark:hover:text-brand-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500"
data-testid="tournament-back-to-index"
@click="backToIndex"
>
โ All tournaments
</button>
<div
v-if="tournaments.length > 1"
class="flex gap-2 overflow-x-auto min-w-0 pb-1"
data-testid="tournament-switcher"
>
<button
v-for="t in tournaments"
:key="t.id"
type="button"
@click="openTournament(t.id)"
:aria-current="selectedId === t.id ? 'page' : undefined"
:class="[
'shrink-0 whitespace-nowrap px-4 py-2 rounded-full text-sm font-medium transition-colors',
selectedId === t.id
? 'bg-brand-600 text-white'
: 'bg-card border border-line text-fg hover:border-brand-400',
]"
>
{{ t.name }}
</button>
</div>
</div>
<!-- Tournament detail -->
<div v-if="selected">
<!-- Hero card: says where the tournament is in its own life before
it says what is in it. -->
<TournamentHeroCard
:tournament="selected"
:matches="selected.matches || []"
:total-matches="isLargeTournament ? selected.match_count : null"
:my-club-id="myClubId"
:my-team-id="myTeamId"
:stage-label="stageLabel"
@select-match="viewMatch"
>
<template #actions>
<!-- View toggle: List always shown; Bracket / Standings shown
based on match round shape. Neither is offered for a large
tournament: both are built from every match at once, which
a paged tournament never holds (SB-1749). -->
<div
v-if="
!isLargeTournament && (hasBracketRounds || hasStandingsRounds)
"
class="inline-flex rounded-md border border-line bg-card p-0.5 shrink-0"
>
<button
type="button"
@click="viewMode = 'list'"
:class="[
'px-3 py-1 text-xs font-medium rounded transition-colors',
viewMode === 'list'
? 'bg-brand-600 text-white'
: 'text-fg-muted hover:text-fg',
]"
>
List
</button>
<button
v-if="hasBracketRounds"
type="button"
@click="viewMode = 'bracket'"
:class="[
'px-3 py-1 text-xs font-medium rounded transition-colors',
viewMode === 'bracket'
? 'bg-brand-600 text-white'
: 'text-fg-muted hover:text-fg',
]"
>
Bracket
</button>
<button
v-if="hasStandingsRounds"
type="button"
@click="viewMode = 'standings'"
:class="[
'px-3 py-1 text-xs font-medium rounded transition-colors',
viewMode === 'standings'
? 'bg-brand-600 text-white'
: 'text-fg-muted hover:text-fg',
]"
>
Standings
</button>
</div>
</template>
</TournamentHeroCard>
<!-- Large tournament: day strip and filters, pinned while the list
scrolls (SB-1865). Compact on a phone โ one row of days, the
league toggle, then a Filters button, the active choices and
the team search (SB-1870). A team's schedule swaps all of it
for one clearable chip. -->
<div
v-if="isLargeTournament && viewMode === 'list' && !matchesLoading"
class="sticky top-0 z-30 -mx-2 sm:-mx-4 px-2 sm:px-4 pt-1 pb-2 mb-3 bg-card border-b border-line shadow-[0_6px_12px_-10px_rgba(0,0,0,0.35)] space-y-1.5"
data-testid="tournament-sticky-bar"
>
<div
v-if="teamMode"
class="flex flex-wrap items-center gap-2 min-w-0 pt-1"
>
<button
type="button"
class="flex-1 sm:flex-initial min-w-0 inline-flex items-center gap-2 h-11 pl-1.5 pr-3 rounded-full bg-brand-600 text-white text-sm font-semibold focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500 focus-visible:ring-offset-1"
:aria-label="`Showing ${teamChipText}. Clear to go back`"
data-testid="tournament-team-chip"
@click="onClearTeam"
>
<ClubLogo
v-if="selectedTeam.logo_url"
:logo-url="selectedTeam.logo_url"
:name="selectedTeam.club_name || selectedTeam.name || ''"
size="xs"
class="bg-white rounded-full"
/>
<span class="truncate"
><span class="font-normal opacity-80">Showing</span>
{{ teamChipText }}</span
>
<span
aria-hidden="true"
class="ml-auto text-lg leading-none opacity-80"
>ร</span
>
</button>
<!-- A club with several ages: switch between them without
leaving the team (SB-1892). One age needs no switch. -->
<div
v-if="teamAges.length > 1"
role="group"
aria-label="Age group"
class="order-3 sm:order-none basis-full sm:basis-auto flex gap-1 overflow-x-auto"
data-testid="tournament-team-ages"
>
<button
v-for="ag in teamAges"
:key="ag.id"
type="button"
:aria-pressed="ag.id === teamAgeId ? 'true' : 'false'"
:class="[
'shrink-0 h-9 px-3 rounded-full text-sm font-semibold border focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500',
ag.id === teamAgeId
? 'bg-brand-600 border-brand-600 text-white dark:bg-brand-500 dark:border-brand-500'
: 'bg-card border-line text-fg hover:border-brand-400',
]"
data-testid="tournament-team-age"
@click="onTeamAge(ag.id)"
>
{{ ag.name }}
</button>
</div>
<TournamentTeamSearch
class="shrink-0 sm:ml-auto"
:tournament-id="selected.id"
@select="onTeam"
/>
</div>
<template v-else>
<TournamentDayStrip
v-if="showDayStrip"
:days="filterDays"
:selected="selectedDay"
:today="tournamentToday"
@update:day="onDay"
/>
<div
class="flex flex-wrap items-center gap-x-2 gap-y-1.5 min-w-0"
>
<TournamentLeagueToggle
class="order-1"
:leagues="filterLeagues"
:selected="selectedLeague"
:all-count="leagueAllCount"
@update:league="onLeague"
/>
<TournamentFilters
class="order-2 sm:order-3 flex-1 sm:basis-full"
:age-groups="filterAgeGroups"
:selected-age-group-id="viewedAgeGroupId"
:groups="filterGroups"
:selected-group="selectedGroupKey"
:selected-group-stage="selectedGroupStage"
:conferences="filterConferences"
:selected-conference-id="selectedConferenceId"
:unplaced="filterUnplaced"
:selected-league="selectedLeague"
:stages="filterStages"
:selected-stage="selectedStage"
:unstaged-count="filterUnstagedCount"
:day-mode="dayMode"
@update:age-group="onAge"
@update:group="onGroup"
@update:conference="onConference"
@update:stage="onStage"
/>
<TournamentTeamSearch
class="order-3 sm:order-2 shrink-0 sm:ml-auto"
:tournament-id="selected.id"
@select="onTeam"
/>
</div>
</template>
</div>
<!-- Tournament Match of the Day (SB-1560): today's pick only, in
every view, for the age group being viewed (SB-1750). All Ages
stacks one banner per age group. No pick renders nothing. -->
<TournamentMotdBanner
v-for="entry in todayMotds"
:key="entry.key"
:pick="entry.pick"
:live-match="entry.liveMatch"
day-label="Today"
@select-match="viewMatch"
/>
<!-- Match loading: the shape of what is coming, only while it is. -->
<div
v-if="matchesLoading"
class="grid gap-2 lg:grid-cols-2"
aria-busy="true"
aria-label="Loading matches"
>
<div
v-for="n in 4"
:key="n"
class="h-[104px] rounded-xl border border-line bg-surface-alt/60 animate-pulse"
></div>
</div>
<template v-else-if="selected.matches && viewMode === 'list'">
<!-- Age group filter -->
<div
v-if="!isLargeTournament && availableAgeGroups.length > 1"
class="mb-4 flex flex-wrap gap-2"
>
<button
@click="ageGroupFilter = null"
:class="[
'px-3 py-1.5 rounded-full text-sm font-medium transition-colors',
ageGroupFilter === null
? 'bg-brand-600 text-white'
: 'bg-card border border-line text-fg hover:border-brand-400',
]"
>
All Ages
</button>
<button
v-for="ag in availableAgeGroups"
:key="ag.id"
@click="ageGroupFilter = ag.id"
:class="[
'px-3 py-1.5 rounded-full text-sm font-medium transition-colors',
ageGroupFilter === ag.id
? 'bg-brand-600 text-white'
: 'bg-card border border-line text-fg hover:border-brand-400',
]"
>
{{ ag.name }}
</button>
</div>
<!-- Team filter: only earns its row once the list is long enough
to need filtering. The match count lives in the hero card. -->
<div
v-if="showTeamFilter"
class="mb-4 flex flex-wrap items-center gap-3"
>
<input
v-model="teamFilter"
type="text"
placeholder="Filter by teamโฆ"
class="px-3 py-2 bg-card border border-line rounded-md text-sm text-fg focus:outline-none focus:ring-2 focus:ring-brand-500 w-full sm:w-48"
/>
<span class="text-sm text-fg-muted"
>{{ filteredMatches.length }} match{{
filteredMatches.length !== 1 ? 'es' : ''
}}</span
>
<button
v-if="teamFilter || ageGroupFilter"
@click="
teamFilter = '';
ageGroupFilter = null;
"
class="text-sm text-brand-600 dark:text-brand-300 hover:text-brand-800 dark:hover:text-brand-200"
>
clear all
</button>
</div>
<!-- Age filter is on but the team input is hidden: still offer a
way back to the unfiltered list. -->
<div v-else-if="ageGroupFilter" class="mb-4">
<button
@click="ageGroupFilter = null"
class="text-sm text-brand-600 dark:text-brand-300 hover:text-brand-800 dark:hover:text-brand-200"
>
clear filter
</button>
</div>
<!-- Large tournament: the page for the current filters is on its
way, failed, or is genuinely empty. Empty is said in words โ
a spinner would promise matches that are not coming. -->
<template v-if="isLargeTournament">
<div
v-if="pageLoading"
class="grid gap-2 lg:grid-cols-2"
aria-busy="true"
aria-label="Loading matches"
data-testid="tournament-page-loading"
>
<div
v-for="n in 6"
:key="n"
class="h-[104px] rounded-xl border border-line bg-surface-alt/60 animate-pulse"
></div>
</div>
<div
v-else-if="pageError && selected.matches.length === 0"
class="text-center py-10 text-fg-muted"
data-testid="tournament-page-error"
>
{{ pageError }}
<button
type="button"
class="ml-1 text-brand-600 dark:text-brand-300 hover:text-brand-800 dark:hover:text-brand-200"
@click="reloadPage"
>
Try again
</button>
</div>
<div
v-else-if="selected.matches.length === 0"
class="text-center py-10 px-4 rounded-xl border border-dashed border-line"
data-testid="tournament-page-empty-state"
>
<p class="text-fg-muted" data-testid="tournament-page-empty">
{{ largeEmptyText }}
</p>
<div
v-if="emptyActions.length > 0"
class="mt-3 flex flex-wrap justify-center gap-2"
>
<button
v-for="action in emptyActions"
:key="action.key"
type="button"
class="h-11 px-4 rounded-full border border-line bg-card text-sm font-medium text-brand-600 dark:text-brand-300 hover:border-brand-400 focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500"
:data-testid="`tournament-empty-${action.key}`"
@click="action.run"
>
{{ action.label }}
</button>
</div>
</div>
</template>
<!-- No matches -->
<div
v-else-if="selected.matches.length === 0"
class="text-center py-10 text-fg-muted"
>
No matches entered yet.
</div>
<!-- Matches exist, but the current filter hides all of them. This
is a filter result, not an empty tournament โ say so. -->
<div
v-else-if="filteredMatches.length === 0"
class="text-center py-10 text-fg-muted"
>
No matches match this filter.
</div>
<!-- One day of a large tournament (SB-1865): the day's matches
under kickoff time-slot headers, in venue time. -->
<template v-if="dayMode && !pageLoading">
<div
v-if="selected.matches.length > 0"
class="flex items-baseline justify-between gap-3 mb-2 px-0.5"
data-testid="tournament-day-heading"
>
<h3 class="text-sm font-bold text-fg">
{{ selectedDayLong }}
<span
v-if="relativeDay(selectedDay)"
class="text-accent-600 dark:text-accent-400"
>ยท {{ relativeDay(selectedDay) }}</span
>
</h3>
<span
v-if="zoneLabel"
class="text-xs text-fg-muted shrink-0"
data-testid="tournament-zone-note"
>Times {{ zoneLabel }}</span
>
</div>
<section
v-for="slot in timeSlots"
:key="slot.key"
class="mb-4"
:aria-label="
slot.label
? `Kickoff ${slot.label}`
: 'Kickoff time to be decided'
"
data-testid="tournament-time-slot"
>
<div class="flex items-center gap-3 mb-2 px-0.5">
<span
class="text-xs font-bold uppercase tracking-wider text-fg tabular-nums"
data-testid="tournament-time-slot-label"
>{{ slot.label || 'Time TBD' }}</span
>
<span class="flex-1 h-px bg-line"></span>
<!-- Every match here shares one tag: said once, here. -->
<TournamentChip
v-if="slot.sharedGroup"
variant="group"
class="shrink-0 max-w-[45%] truncate"
data-testid="tournament-time-slot-group"
>{{ slot.sharedGroup }}</TournamentChip
>
<span class="text-xs text-fg-muted tabular-nums shrink-0">
{{ slot.matches.length }}
{{ slot.matches.length === 1 ? 'match' : 'matches' }}
</span>
</div>
<div class="grid gap-2 lg:grid-cols-2">
<TournamentMatchRow
v-for="match in slot.matches"
:key="match.id"
:match="match"
:show-kickoff="false"
:time-zone="venueZone"
:show-age-chip="false"
:show-round-chip="isKnockoutRound(match)"
:show-group-chip="!slot.sharedGroup"
:my-club-id="myClubId"
:my-team-id="myTeamId"
:can-edit="canEditMatchRow(match)"
:saving="savingMatchId === match.id"
:save-error="saveErrorMatchId === match.id ? saveError : ''"
:is-motd="motdMatchIds.includes(match.id)"
@select="viewMatch"
@save="saveScore"
/>
</div>
</section>
</template>
<!-- One team's whole tournament (SB-1870): every day it plays,
under day headers, kickoffs in venue time. -->
<template v-if="teamMode && !pageLoading">
<div
v-if="selected.matches.length > 0"
class="flex flex-wrap items-baseline justify-between gap-x-3 gap-y-0.5 mb-2 px-0.5"
data-testid="tournament-team-heading"
>
<h3 class="text-sm font-bold text-fg min-w-0">
{{ teamChipText }} schedule
</h3>
<span
v-if="zoneLabel"
class="text-xs text-fg-muted shrink-0"
data-testid="tournament-zone-note"
>Times {{ zoneLabel }}</span
>
</div>
<section
v-for="day in teamDays"
:key="day.date ?? 'undated'"
class="mb-4"
:aria-label="day.date ? formatDayBand(day.date) : 'Date TBD'"
data-testid="tournament-team-day"
>
<div class="flex items-center gap-3 px-0.5 pb-1.5">
<span
class="text-sm font-bold text-fg uppercase tracking-wide"
data-testid="tournament-team-day-label"
>
{{ formatDayBand(day.date) }}
<span
v-if="relativeDay(day.date)"
class="text-accent-600 dark:text-accent-400"
>ยท {{ relativeDay(day.date) }}</span
>
</span>
<span class="flex-1 h-px bg-line"></span>
<span class="text-xs text-fg-muted tabular-nums shrink-0">
{{ day.matches.length }}
{{ day.matches.length === 1 ? 'match' : 'matches' }}
</span>
</div>
<div class="grid gap-2 lg:grid-cols-2">
<TournamentMatchRow
v-for="match in day.matches"
:key="match.id"
:match="match"
:time-zone="venueZone"
:show-age-chip="false"
:show-round-chip="isKnockoutRound(match)"
:show-group-chip="true"
:my-club-id="myClubId"
:my-team-id="myTeamId"
:can-edit="canEditMatchRow(match)"
:saving="savingMatchId === match.id"
:save-error="saveErrorMatchId === match.id ? saveError : ''"
:is-motd="motdMatchIds.includes(match.id)"
@select="viewMatch"
@save="saveScore"
/>
</div>
</section>
</template>
<!-- Group stage / Showcase / Knockout / Placement finals /
Consolation / Matches, each grouped by day. -->
<div
v-for="section in dayMode || teamMode ? [] : listSections"
:key="section.key"
class="mb-6"
data-testid="tournament-section"
>
<h3
class="text-xs font-semibold text-fg-muted uppercase tracking-wider mb-2"
>
<!-- Phones get the short round label (SB-1875); the full
heading stays for screen readers. -->
<span
data-testid="tournament-section-title"
:class="section.shortTitle ? 'sr-only sm:not-sr-only' : ''"
>{{ section.title }}</span
>
<span
v-if="section.shortTitle"
class="sm:hidden"
aria-hidden="true"
>{{ section.shortTitle }}</span
>
</h3>
<div
v-for="day in section.days"
:key="`${section.key}-${day.date ?? 'undated'}`"
class="mb-3 last:mb-0"
>
<!-- Day band: carries the date once for the whole day, and
says "Today" / "Tomorrow" when that is more useful than
a weekday. -->
<div
class="flex items-center gap-3 px-0.5 pb-1.5"
data-testid="tournament-day-band"
>
<span
class="text-sm font-bold text-fg uppercase tracking-wide"
>
{{ formatDayBand(day.date) }}
<span
v-if="relativeDay(day.date)"
class="text-accent-600 dark:text-accent-400"
>ยท {{ relativeDay(day.date) }}</span
>
</span>
<span class="flex-1 h-px bg-line"></span>
<span class="text-xs text-fg-muted tabular-nums shrink-0">
{{ day.matches.length }}
{{ day.matches.length === 1 ? 'match' : 'matches' }}
</span>
</div>
<div class="grid gap-2 lg:grid-cols-2">
<TournamentMatchRow
v-for="match in day.matches"
:key="match.id"
:match="match"
:show-age-chip="showAgeChip"
:show-round-chip="section.showRoundChip"
:show-group-chip="section.showGroupChip"
:my-club-id="myClubId"
:my-team-id="myTeamId"
:can-edit="canEditMatchRow(match)"
:saving="savingMatchId === match.id"
:save-error="saveErrorMatchId === match.id ? saveError : ''"
:is-motd="motdMatchIds.includes(match.id)"
@select="viewMatch"
@save="saveScore"
/>
</div>
</div>
</div>
<!-- Large tournament: how much of the filtered list is on screen,
and the next page. No count is shown until the server has
given one. -->
<div
v-if="isLargeTournament && selected.matches.length > 0"
class="mt-2 mb-6 flex flex-wrap items-center justify-center gap-3 text-sm text-fg-muted"
data-testid="tournament-page-footer"
>
<span v-if="filteredTotal != null" data-testid="tournament-shown">
Showing {{ selected.matches.length }} of {{ filteredTotal }}
{{ filteredTotal === 1 ? 'match' : 'matches' }}
</span>
<span v-if="pageError" data-testid="tournament-more-error">{{
pageError
}}</span>
<button
v-if="hasMoreMatches"
type="button"
:disabled="loadingMore"
data-testid="tournament-load-more"
class="px-4 py-1.5 rounded-full text-sm font-medium bg-card border border-line text-fg hover:border-brand-400 disabled:opacity-50"
@click="loadMore"
>
{{ loadingMore ? 'Loadingโฆ' : 'Load more' }}
</button>
</div>
</template>
<!-- โโ Bracket view โโ -->
<template v-else-if="selected.matches && viewMode === 'bracket'">
<!-- Selectors: age group + bracket group -->
<div
class="mb-5 flex flex-col sm:flex-row sm:items-center sm:flex-wrap gap-3"
>
<div
v-if="bracketAgeGroups.length > 0"
class="flex flex-wrap items-center gap-2"
>
<span
class="text-xs font-semibold text-fg-muted uppercase tracking-wider mr-1"
>Age</span
>
<button
v-for="ag in bracketAgeGroups"
:key="`bag-${ag.id}`"
@click="bracketAgeGroupId = ag.id"
:class="[
'px-3 py-1.5 rounded-full text-sm font-medium transition-colors',
bracketAgeGroupId === ag.id
? 'bg-indigo-600 text-white'
: 'bg-card border border-line text-fg hover:border-indigo-400',
]"
>
{{ ag.name }}
</button>
</div>
<div
v-if="bracketGroups.length > 1"
class="flex flex-wrap items-center gap-2"
>
<span
class="text-xs font-semibold text-fg-muted uppercase tracking-wider mr-1"
>Bracket</span
>
<button
v-for="g in bracketGroups"
:key="`bg-${g}`"
@click="bracketGroup = g"
:class="[
'px-3 py-1.5 rounded-full text-sm font-medium transition-colors',
bracketGroup === g
? 'bg-brand-600 text-white'
: 'bg-card border border-line text-fg hover:border-brand-400',
]"
>
{{ g }}
</button>
</div>
<!-- Follow this bracket: push at fulltime for every match in
(tournament + group + age group). Two-state toggle. -->
<button
v-if="canFollowBracket"
type="button"
@click="toggleBracketFollow"
data-testid="bracket-follow-toggle"
:class="[
'sm:ml-auto inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm font-medium transition-colors',
isBracketFollowed
? 'bg-green-600 text-white hover:bg-green-700'
: 'bg-card border border-line text-fg hover:border-brand-400',
]"
>
<span v-if="isBracketFollowed">โ Following โ Unfollow</span>
<span v-else>๐ Follow this bracket</span>
</button>
<span
v-else-if="bracketNeedsPush"
class="sm:ml-auto text-xs text-fg-muted"
data-testid="bracket-follow-push-hint"
>
๐ Enable notifications in your profile to follow this bracket.
</span>
</div>
<TournamentBracket
:matches="bracketMatches"
:motd-match-ids="motdMatchIds"
@match-click="viewMatch"
/>
</template>
<!-- โโ Standings view โโ -->
<template v-else-if="selected.matches && viewMode === 'standings'">
<!-- Selectors: age group + tournament group, reused pattern from Bracket -->
<div
class="mb-5 flex flex-col sm:flex-row sm:items-center sm:flex-wrap gap-3"
>
<div
v-if="standingsAgeGroups.length > 1"
class="flex flex-wrap items-center gap-2"
>
<span
class="text-xs font-semibold text-fg-muted uppercase tracking-wider mr-1"
>Age</span
>
<button
v-for="ag in standingsAgeGroups"
:key="`sag-${ag.id}`"
@click="standingsAgeGroupId = ag.id"
:class="[
'px-3 py-1.5 rounded-full text-sm font-medium transition-colors',
standingsAgeGroupId === ag.id
? 'bg-indigo-600 text-white'
: 'bg-card border border-line text-fg hover:border-indigo-400',
]"
>
{{ ag.name }}
</button>
</div>
<div
v-if="standingsGroups.length > 1"
class="flex flex-wrap items-center gap-2"
>
<span
class="text-xs font-semibold text-fg-muted uppercase tracking-wider mr-1"
>Bracket</span
>
<button
v-for="g in standingsGroups"
:key="`sg-${g}`"
@click="standingsGroup = g"
:class="[
'px-3 py-1.5 rounded-full text-sm font-medium transition-colors',
standingsGroup === g
? 'bg-brand-600 text-white'
: 'bg-card border border-line text-fg hover:border-brand-400',
]"
>
{{ g }}
</button>
</div>
<!-- Follow this bracket: group-stage pools (e.g. NAC 'Bracket A')
render here. Push at fulltime for every match in the selected
tournament + group + age. Two-state toggle. -->
<button
v-if="canFollowStandingsBracket"
type="button"
@click="toggleStandingsBracketFollow"
data-testid="standings-bracket-follow-toggle"
:class="[
'sm:ml-auto inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm font-medium transition-colors',
isStandingsBracketFollowed
? 'bg-green-600 text-white hover:bg-green-700'
: 'bg-card border border-line text-fg hover:border-brand-400',
]"
>
<span v-if="isStandingsBracketFollowed"
>โ Following โ Unfollow</span
>
<span v-else>๐ Follow this bracket</span>
</button>
<span
v-else-if="standingsNeedsPush"
class="sm:ml-auto text-xs text-fg-muted"
data-testid="standings-bracket-follow-push-hint"
>
๐ Enable notifications in your profile to follow this bracket.
</span>
</div>
<TournamentStandings :matches="standingsMatches" />
</template>
</div>
</template>
</template>
</div>
</template>
<script>
import { ref, computed, onMounted, onUnmounted, unref, watch } from 'vue';
import { useAuthStore } from '@/stores/auth';
import { useFilterMemory } from '@/composables/useFilterMemory';
import { getApiBaseUrl } from '../config/api';
import TournamentBracket from './TournamentBracket.vue';
import TournamentStandings from './TournamentStandings.vue';
import MatchDetailView from './MatchDetailView.vue';
import ModalOverlay from './ui/ModalOverlay.vue';
import TournamentHeroCard from './TournamentHeroCard.vue';
import TournamentMatchRow from './TournamentMatchRow.vue';
import TournamentMotdBanner from './TournamentMotdBanner.vue';
import TournamentFilters from './TournamentFilters.vue';
import TournamentDayStrip from './TournamentDayStrip.vue';
import TournamentChip from './ui/TournamentChip.vue';
import TournamentIndex from './TournamentIndex.vue';
import TournamentLeagueToggle from './TournamentLeagueToggle.vue';
import TournamentTeamSearch from './TournamentTeamSearch.vue';
import ClubLogo from './shared/ClubLogo.vue';
import { parseTournamentPath, tournamentPath } from '../utils/tournamentRoute';
import { useLiveRowSync } from '@/composables/useLiveRowSync';
import { useBracketFollows } from '../composables/useBracketFollows';
import { usePushNotifications } from '../composables/usePushNotifications';
import {
isLargeTournament as isLargeSummary,
useTournamentMatches,
} from '../composables/useTournamentMatches';
import {
compareByStatus,
groupMatchesByDay,
localDateKey,
relativeDayLabel,
} from '../utils/tournamentStatus';
import { canEditMatch } from '../utils/matchPermissions';
import {
conferenceDisplayName,
findGroupOption,
formatDayLong,
groupDisplayLabel,
groupByTimeSlot,
hasTournamentView,
readTournamentQuery,
rememberedTournamentView,
tournamentQueryString,
tournamentViewToRemember,
venueTimeZone,
zoneAbbreviation,
} from '../utils/tournamentDays';
import { pickAgeGroupId, picksForView } from '../utils/tournamentMotd';
import {
BRACKET_ROUNDS,
KNOCKOUT_ROUNDS,
KNOCKOUT_ROUND_ORDER,
} from '../utils/tournamentRounds';
import {
STAGE_ROUNDS,
STAGE_ROUND_SECTIONS,
buildStageSections,
competitionSections,
roundRank,
} from '../utils/tournamentStages';
// Past this many matches the list is long enough that a team filter earns its
// row. Below it the input is larger than the thing it filters.
const TEAM_FILTER_THRESHOLD = 8;
export default {
name: 'TournamentMatchCenter',
components: {
TournamentBracket,
TournamentStandings,
MatchDetailView,
ModalOverlay,
TournamentHeroCard,
TournamentMatchRow,
TournamentMotdBanner,
TournamentFilters,
TournamentDayStrip,
TournamentChip,
TournamentIndex,
TournamentLeagueToggle,
TournamentTeamSearch,
ClubLogo,
},
setup() {
const authStore = useAuthStore();
// The last view this viewer picked on a tournament page (SB-1905): this
// browser's copy and, signed in, the account's, like Table and Matches.
const viewMemory = useFilterMemory(
'tournament',
() => authStore.state?.profile?.id ?? authStore.state?.user?.id ?? null
);
const bracketFollows = useBracketFollows();
const { isEnabled: pushEnabled } = usePushNotifications();
const tournaments = ref([]);
const loading = ref(true);
const error = ref(null);
// โโ season selector โโ
// Tournaments are scoped to a season; the view defaults to the newest
// season and lets the user switch back to prior seasons (same idiom as
// the Table / Matches tabs).
const seasons = ref([]);
const selectedSeasonId = ref(null);
// How the matches are fetched โ one detail call, or paged and filtered
// by the server for a large tournament โ lives in the composable
// (SB-1749). `selected` is its tournament: the header plus whichever
// matches are loaded.
const tournamentMatches = useTournamentMatches();
const selectedId = ref(null);
const selected = tournamentMatches.tournament;
const matchesLoading = ref(false);
const isLargeTournament = tournamentMatches.isLarge;
const teamFilter = ref('');
const ageGroupFilter = ref(null);
// โโ view mode + bracket / standings selectors โโ
const viewMode = ref('list'); // 'list' | 'bracket' | 'standings'
const bracketAgeGroupId = ref(null);
const bracketGroup = ref(null);
const standingsAgeGroupId = ref(null);
const standingsGroup = ref(null);
// โโ inline match detail (preview) navigation โโ
// When set, MatchDetailView replaces the tournament page (same pattern
// as MatchesView). Back button clears it.
const selectedMatchId = ref(null);
const viewMatch = match => {
selectedMatchId.value = match.id;
};
const handleBackFromMatchDetail = () => {
selectedMatchId.value = null;
};
// โโ helpers โโ
// Day-band heading: "Sat 29 Aug". The relative label ("Today" /
// "Tomorrow") is rendered beside it, not instead of it โ a parent still
// wants the date they can put in a calendar.
const formatDayBand = d => {
if (!d) return 'Date TBD';
return new Date(String(d).slice(0, 10) + 'T00:00:00').toLocaleDateString(
'en-US',
{ weekday: 'short', day: 'numeric', month: 'short' }
);
};
const relativeDay = d => relativeDayLabel(d);
// โโ data โโ
const formatSeasonDates = season => {
if (!season?.start_date || !season?.end_date) return '';
const startYear = new Date(season.start_date).getFullYear();
const endYear = new Date(season.end_date).getFullYear();
return `${startYear}-${endYear}`;
};
const fetchSeasons = async () => {
try {
const data = await authStore.apiRequest(
`${getApiBaseUrl()}/api/seasons`,
{ method: 'GET' }
);
// Newest first, so seasons[0] is the fallback default.
const sorted = (data || []).sort(
(a, b) => new Date(b.start_date) - new Date(a.start_date)
);
seasons.value = sorted;
// Default to the admin-set current season, else newest.
const current = sorted.find(s => s.is_current) || sorted[0];
if (current && selectedSeasonId.value == null) {
selectedSeasonId.value = current.id;
}
} catch (err) {
// Seasons are a secondary filter; a failure here should not blank the
// whole view. Fall back to the unfiltered tournament list (no season
// selector) rather than surfacing a page-level error.
console.error('Error fetching seasons:', err);
}
};
// โโ URLs (SB-1767) โโ
// `/tournaments` is the season index, `/tournaments/<id>` one tournament.
// App.vue decides that a path opens this tab; this component decides
// index vs detail. Nothing here ever writes the page title or a preview
// tag: the title stays "Missing Table" whatever is open.
const indexNotice = ref(null);
// Async work outlives the component (tab switched, signed out) and must
// not write the address bar or fetch for a page nobody is on.
let isUnmounted = false;
// Bumped by every navigation: card, switcher, "All tournaments", back /
// forward, season change. A continuation that finds it moved belongs to
// a navigation the visitor has already left, and does nothing.
let navSeq = 0;
// Bumped by every list fetch; only the latest one owns `loading` and
// `tournaments`.
let listSeq = 0;
// The visitor asked for the index, so a one-tournament season is not
// opened for them again until the season changes or the tab is re-entered.
let indexRequested = false;
// The open tournament was pushed on top of the index: "All tournaments"
// is then a history.back(), so the back button and the link agree.
let pushedFromIndex = false;
// The season was set to follow a link into another season, not by the
// selector, so its watcher must not fetch or reset the URL.
let seasonSetByLink = false;
const currentRoute = () => parseTournamentPath(window.location?.pathname);
const writeHistory = (method, path) => {
if (isUnmounted) return;
try {
window.history[method](null, '', path);
} catch (err) {
// A sandboxed frame can refuse; the page still works without a URL.
console.error('Error updating the address bar:', err);
}
};
const fetchTournamentList = async seasonId => {
const url = new URL(`${getApiBaseUrl()}/api/tournaments`);
if (seasonId != null) url.searchParams.set('season_id', seasonId);
const data = await authStore.apiRequest(url.toString(), {
method: 'GET',
});
// Live first, then what is about to start, then the rest of the
// calendar, then what is finished โ the index reads in that order.
return (data || []).slice().sort((a, b) => compareByStatus(a, b));
};
const showIndex = () => {
selectedId.value = null;
selected.value = null;
motdPicks.value = [];
viewMode.value = 'list';
pushedFromIndex = false;
};
// No id asked for: the index, except that a season with exactly one
// tournament opens it โ replacing the URL, so back does not land on an
// index that would only open it again.
const openDefault = async () => {
if (tournaments.value.length === 1 && !indexRequested) {
const id = tournaments.value[0].id;
// Replaced, not pushed: there is no index behind it to go back to.
pushedFromIndex = false;
writeHistory('replaceState', tournamentPath(id));
await selectTournament(id);
} else {
showIndex();
}
};
// An id from the URL. It must be opened from its row in a tournament
// list โ `match_count` there picks small or large mode โ so an id in
// another season is looked up in the unfiltered list, never through the
// detail endpoint.
const openFromLink = async (id, seq) => {
if (
!tournaments.value.some(t => t.id === id) &&
selectedSeasonId.value != null
) {
const all = await fetchTournamentList(null);
if (isUnmounted || seq !== navSeq) return;
const row = all.find(t => t.id === id);
if (row && row.season_id != null) {
if (row.season_id !== selectedSeasonId.value) {
seasonSetByLink = true;
selectedSeasonId.value = row.season_id;
}
tournaments.value = all.filter(t => t.season_id === row.season_id);
}
}
if (tournaments.value.some(t => t.id === id)) {
await selectTournament(id);
return;
}
// Unknown, inactive or hidden from this viewer: the same words for
// each, so a link never confirms that a tournament exists.
indexNotice.value = "That tournament isn't available.";
showIndex();
writeHistory('replaceState', tournamentPath());
};
// `wantedId`: an id from the URL, opened once the list can say where it
// is. Without one the season's default applies.
const fetchTournaments = async (wantedId = null) => {
const seq = navSeq;
const fetchId = ++listSeq;
const current = () => !isUnmounted && fetchId === listSeq;
try {
loading.value = true;
error.value = null;
const list = await fetchTournamentList(selectedSeasonId.value);
if (!current()) return;
tournaments.value = list;
// A navigation since this fetch began has already chosen the view.
if (seq !== navSeq) return;
if (wantedId != null) {
await openFromLink(wantedId, seq);
} else {
await openDefault();
}
} catch (err) {
if (current()) error.value = err.message;
} finally {
if (current()) loading.value = false;
}
};
// A card or a switcher chip. Pushed, so back returns to where it was
// opened from.
const openTournament = async id => {
if (id === selectedId.value) return;
navSeq += 1;
const fromIndex = selectedId.value == null;
writeHistory('pushState', tournamentPath(id));
pushedFromIndex = fromIndex;
indexNotice.value = null;
await selectTournament(id);
};
const backToIndex = () => {
navSeq += 1;
indexRequested = true;
indexNotice.value = null;
if (pushedFromIndex) {
window.history.back();
} else {
writeHistory('pushState', tournamentPath());
}
showIndex();
};
// Back / forward between the index and a tournament. A path outside the
// tab is App.vue's to handle: it switches tabs, and this unmounts.
const onPopState = () => {
const route = currentRoute();
if (!route) return;
navSeq += 1;
indexNotice.value = null;
pushedFromIndex = false;
if (route.kind === 'index') {
indexRequested = true;
showIndex();
return;
}
if (route.id === selectedId.value) {
// Same tournament, another day or filter: put that view back.
tournamentMatches
.applyView(readTournamentQuery(window.location?.search))
.then(() => syncViewUrl('replaceState'))
.catch(err => console.error('Error restoring the view:', err));
return;
}
if (tournaments.value.some(t => t.id === route.id)) {
selectTournament(route.id);
} else {
fetchTournaments(route.id);
}
};
// โโ Tournament Match of the Day (SB-1560) โโ
// Picks are decoration on top of the schedule: a failed fetch leaves the
// page as it would be with no picks, never on an error path.
const motdPicks = ref([]);
const fetchMotd = async id => {
if (isUnmounted) return;
try {
const data = await authStore.apiRequest(
`${getApiBaseUrl()}/api/tournaments/${id}/motd`,
{ method: 'GET' }
);
// A late answer for a tournament the visitor has already left.
if (isUnmounted || selectedId.value !== id) return;
motdPicks.value = Array.isArray(data?.picks) ? data.picks : [];
} catch (err) {
console.error('Error fetching match of the day:', err);
}
};
// Today's picks for the age group on screen (SB-1750): one, or none โ
// never another age group's. All Ages shows every pick for the day.
// `liveMatch`: the tournament payload's copy is kept current by realtime;
// the pick's embedded match is a snapshot from when it loaded, and all
// there is when the match is not on the loaded page.
const todayMotds = computed(() =>
picksForView(motdPicks.value, {
today: localDateKey(),
ageGroupId: viewedAgeGroupId.value,
}).map((pick, i) => {
const id = pick.match?.id;
return {
key: `${pickAgeGroupId(pick) ?? 'none'}-${id ?? i}`,
pick,
liveMatch:
id == null
? null
: (selected.value?.matches ?? []).find(m => m.id === id) || null,
};
})
);
const motdMatchIds = computed(() =>
motdPicks.value.map(p => p.match?.id).filter(id => id != null)
);
const selectTournament = async id => {
if (isUnmounted) return;
selectedId.value = id;
motdPicks.value = [];
fetchMotd(id);
matchesLoading.value = true;
teamFilter.value = '';
ageGroupFilter.value = null;
// The row from the tournament list carries the exact match_count the
// scale switch reads, and is the header of a large tournament.
const summary = tournaments.value.find(t => t.id === id) ?? { id };
// A large tournament has no bracket or standings view to stay on.
if (isLargeSummary(summary)) viewMode.value = 'list';
// A link to this tournament may name a day and filters (SB-1865).
// One that names none opens on what this viewer last picked here
// (SB-1905); a link that names a view always wins.
const route = currentRoute();
let wanted =
route?.kind === 'detail' && route.id === id
? readTournamentQuery(window.location?.search)
: {};
if (!hasTournamentView(wanted)) {
wanted = rememberedTournamentView(viewMemory.load(), id);
}
try {
await tournamentMatches.load(summary, wanted);
// The address bar says what actually opened, not what was asked.
if (selectedId.value === id) syncViewUrl('replaceState');
} catch (err) {
error.value = err.message;
} finally {
matchesLoading.value = false;
}
};
// A tournament page is often left open through a match โ on a phone, on a
// sideline. Realtime keeps live rows current, and a refetch when the tab
// comes back covers whatever the socket missed (SB-909). Without this the
// page shows the score it loaded with until someone reloads it.
const selectedMatches = computed(() => selected.value?.matches ?? []);
const refreshSelected = async () => {
if (selectedId.value == null) return;
fetchMotd(selectedId.value);
try {
await tournamentMatches.refresh();
} catch (err) {
// A background refresh that fails leaves what is on screen alone โ
// it is stale, not wrong, and blanking the page would be worse.
console.error('Error refreshing tournament:', err);
}
};
// โโ filtered + sectioned matches โโ
const availableAgeGroups = computed(() => {
const matches = selected.value?.matches ?? [];
const seen = new Map();
for (const m of matches) {
if (m.age_group && !seen.has(m.age_group.id)) {
seen.set(m.age_group.id, m.age_group);
}
}
return [...seen.values()].sort((a, b) => a.name.localeCompare(b.name));
});
// The age group on screen, in either mode: the server-side selection of a
// large tournament, the chip of a small one (null = All Ages). The
// bracket and standings views of a small tournament each keep their own
// age selection (SB-1750).
const viewedAgeGroupId = computed(() => {
if (isLargeTournament.value) {
return tournamentMatches.selectedAgeGroupId.value;
}
if (viewMode.value === 'bracket') return bracketAgeGroupId.value;
if (viewMode.value === 'standings') return standingsAgeGroupId.value;
return ageGroupFilter.value;
});
// What an empty page of a large tournament says. An age group with no
// matches is a real state, so it is named, not left spinning.
const largeEmptyText = computed(() => {
const age = tournamentMatches.ageGroups.value.find(
ag => ag.id === tournamentMatches.selectedAgeGroupId.value
);
if (teamMode.value) {
return `No ${teamChipText.value} matches in this tournament yet.`;
}
if (dayMode.value) {
const day = formatDayLong(selectedDay.value);
const conference = selectedConference.value;
const group = tournamentMatches.selectedGroup.value;
const who = [
age?.name,
conference ? null : tournamentMatches.selectedLeague.value,
conferenceDisplayName(
conference,
tournamentMatches.conferences.value
),
selectedStageRow.value?.label,
group ? groupLabel(group) : null,
]
.filter(Boolean)
.join(' ');
return `No ${who ? `${who} ` : ''}matches on ${day}.`;
}
// Narrowed but not to a day: say by what, so the way out is plain.
const narrowedBy = [
age?.name,
selectedConference.value
? conferenceDisplayName(
selectedConference.value,
tournamentMatches.conferences.value
)
: tournamentMatches.selectedLeague.value,
selectedStageRow.value?.label,
tournamentMatches.selectedGroup.value
? groupLabel(tournamentMatches.selectedGroup.value)
: null,
].filter(Boolean);
if (narrowedBy.length > (age?.name ? 1 : 0)) {
return `No ${narrowedBy.join(' ')} matches.`;
}
return age?.name
? `No ${age.name} matches entered yet.`
: 'No matches entered yet.';
});
// Ways out of an empty list: drop the narrowing filter. Offered with or
// without a day open.
const emptyActions = computed(() => {
if (teamMode.value) return [];
const out = [];
if (tournamentMatches.selectedLeague.value) {
out.push({
key: 'all-leagues',
label: 'Show both leagues',
run: () => onLeague(null),
});
}
if (tournamentMatches.selectedConferenceId.value != null) {
out.push({
key: 'all-conferences',
label: 'Show all conferences',
run: () => onConference(null),
});
}
if (tournamentMatches.selectedStage.value) {
out.push({
key: 'all-stages',
label: 'Show all stages',
run: () => onStage(null),
});
}
if (tournamentMatches.selectedGroup.value) {
out.push({
key: 'all-groups',
label: 'Show all groups',
run: () => onGroup(null),
});
}
return out;
});
// In a large tournament the server has already applied the filters, so
// the loaded rows are the filtered rows.
const filteredMatches = computed(() => {
let matches = selected.value?.matches ?? [];
if (ageGroupFilter.value !== null) {
matches = matches.filter(m => m.age_group?.id === ageGroupFilter.value);
}
if (!teamFilter.value) return matches;
const q = teamFilter.value.toLowerCase();
return matches.filter(
m =>
m.home_team?.name?.toLowerCase().includes(q) ||
m.away_team?.name?.toLowerCase().includes(q)
);
});
// Sort key used across all three sections: ascending by match_date first,
// then by scheduled_kickoff within the day, then by id as a stable
// tiebreaker. Matches without a scheduled_kickoff still group correctly
// because the date sort still applies; they fall to the bottom of the
// day in id-order.
const byKickoffAsc = (a, b) => {
const da = a.match_date || '';
const db = b.match_date || '';
if (da !== db) return da < db ? -1 : 1;
const ka = a.scheduled_kickoff || '';
const kb = b.scheduled_kickoff || '';
if (ka !== kb) return ka < kb ? -1 : 1;
return (a.id || 0) - (b.id || 0);
};
// Competition stages (SB-1875) take their matches on every round, each
// stage in sections by round and bracket; `rest` is what is left for the
// round sections below โ the group stage's pools, legacy stage labels,
// the knockouts of a tournament whose groups name no competition.
const stageSplit = computed(() =>
competitionSections(filteredMatches.value.slice().sort(byKickoffAsc))
);
const restMatches = computed(() => stageSplit.value.rest);
const groupStageMatches = computed(() =>
restMatches.value.filter(m => m.tournament_round === 'group_stage')
);
// Knockout: round first (R32 โ R16 โ QF โ SF โ 3rd โ Final), then
// chronological within the round. This keeps the visual flow of the
// tournament progression intact while still ordering within each round.
const knockoutMatches = computed(() => {
const order = KNOCKOUT_ROUND_ORDER;
return restMatches.value
.filter(m => KNOCKOUT_ROUNDS.has(m.tournament_round))
.slice()
.sort((a, b) => {
const r =
order.indexOf(a.tournament_round) -
order.indexOf(b.tournament_round);
return r !== 0 ? r : byKickoffAsc(a, b);
});
});
// Showcase, placement finals and consolation: one section per stage
// label within each round (SB-1749).
const stageSections = round =>
buildStageSections(
restMatches.value,
STAGE_ROUND_SECTIONS.find(s => s.round === round)
).map(section => ({
...section,
showRoundChip: false,
showGroupChip: false,
}));
const untaggedMatches = computed(() =>
restMatches.value.filter(
m =>
!m.tournament_round ||
(!KNOCKOUT_ROUNDS.has(m.tournament_round) &&
!STAGE_ROUNDS.has(m.tournament_round) &&
m.tournament_round !== 'group_stage')
)
);
// "U9" before "U15": the number, not the string.
const byAgeName = (a, b) =>
(parseInt(String(a.name).replace(/\D/g, ''), 10) || 0) -
(parseInt(String(b.name).replace(/\D/g, ''), 10) || 0);
// โโ days, conferences and the address bar (SB-1865) โโ
const selectedDay = tournamentMatches.selectedDay;
const filterDays = computed(() => tournamentMatches.days.value ?? []);
// A day is open: the list is that day's, under time-slot headers.
const teamMode = tournamentMatches.teamMode;
const selectedTeam = tournamentMatches.selectedTeam;
const dayMode = computed(
() => isLargeTournament.value && !!selectedDay.value && !teamMode.value
);
// "IFA ยท U15" โ the team on screen and the age it is shown at.
const teamChipText = computed(() => {
const team = selectedTeam.value;
if (!team) return '';
const id = tournamentMatches.selectedAgeGroupId.value;
const age =
tournamentMatches.ageGroups.value.find(ag => ag.id === id)?.name ??
(team.age_groups || []).find(ag => ag.id === id)?.name;
return [team.name || 'Selected team', age].filter(Boolean).join(' ยท ');
});
// The team's matches, in kickoff order, under one header per day.
const teamDays = computed(() =>
teamMode.value
? groupMatchesByDay(
(selected.value?.matches ?? []).slice().sort(byKickoffAsc)
)
: []
);
const selectedStageRow = computed(
() =>
(tournamentMatches.stages.value || []).find(
st => st.key === tournamentMatches.selectedStage.value
) ?? null
);
// A group as the Group control names it: "Group 17" inside the Showcase
// stage, its stored key elsewhere (SB-1873).
const groupLabel = key =>
groupDisplayLabel(
findGroupOption(
tournamentMatches.groups.value,
key,
tournamentMatches.selectedGroupStage.value ??
tournamentMatches.selectedStage.value
) ?? { key },
tournamentMatches.selectedStage.value
);
// The All segment's count: the age's matches on the open day (or in
// all), when the server counted them.
const leagueAllCount = computed(() => {
const age = tournamentMatches.ageGroups.value.find(
ag => ag.id === tournamentMatches.selectedAgeGroupId.value
);
const n = dayMode.value ? age?.matches_on_date : age?.matches;
return typeof n === 'number' ? n : null;
});
// One day needs no strip; its date is in the heading.
const showDayStrip = computed(() => filterDays.value.length > 1);
const tournamentToday = computed(
() => tournamentMatches.venueToday.value ?? localDateKey()
);
const selectedConference = computed(
() =>
(tournamentMatches.conferences.value || []).find(
c => c.id === tournamentMatches.selectedConferenceId.value
) ?? null
);
const selectedDayLong = computed(() => formatDayLong(selectedDay.value));
// Kickoffs read in the venue's time, and say which zone that is.
const venueZone = computed(() => venueTimeZone(selected.value));
const zoneLabel = computed(() => {
if (!venueZone.value) return '';
const abbr = zoneAbbreviation(venueZone.value);
const place = selected.value?.location;
return place ? `local to ${place}${abbr ? ` (${abbr})` : ''}` : abbr;
});
// A tag every match in a slot shares rides on the slot header instead
// of repeating on each card; a slot with mixed tags keeps them per card.
const timeSlots = computed(() =>
groupByTimeSlot(selected.value?.matches ?? [], venueZone.value).map(
slot => {
const tags = new Set(slot.matches.map(m => m.tournament_group));
const [only] = tags;
return {
...slot,
sharedGroup: tags.size === 1 && only ? only : null,
};
}
)
);
const isKnockoutRound = match =>
KNOCKOUT_ROUNDS.has(match.tournament_round);
// The open view as a URL:
// `/tournaments/<id>?day=&age=&league=&conf=&stage=&group=`, or one
// team's schedule, `?age=&team=`. Only a large tournament has a
// server-side view to put there.
// The stage of the picked group's option goes in the link only when the
// link would not say it otherwise: the group is an option of more than
// one stage, and it is not the selected stage's (SB-1875).
const linkedGroupStage = () => {
const key = tournamentMatches.selectedGroup.value;
const stage = tournamentMatches.selectedGroupStage.value;
if (!key || !stage || stage === tournamentMatches.selectedStage.value) {
return null;
}
const options = (tournamentMatches.groups.value || []).filter(
g => g.key === key
);
return options.length > 1 ? stage : null;
};
const viewPath = () => {
if (selectedId.value == null) return null;
let query = '';
if (isLargeTournament.value && teamMode.value) {
query = tournamentQueryString({
ageGroupId: tournamentMatches.selectedAgeGroupId.value,
teamId: selectedTeam.value.team_id,
});
} else if (isLargeTournament.value) {
query = tournamentQueryString({
day: selectedDay.value,
ageGroupId: tournamentMatches.selectedAgeGroupId.value,
conferenceId: tournamentMatches.selectedConferenceId.value,
group: tournamentMatches.selectedGroup.value,
groupStage: linkedGroupStage(),
league: tournamentMatches.selectedLeague.value,
stage: tournamentMatches.selectedStage.value,
});
}
return `${tournamentPath(selectedId.value)}${query}`;
};
// Writes only while this tournament is the one in the address bar, and
// only when the view actually differs from it.
function syncViewUrl(method) {
const route = currentRoute();
if (route?.kind !== 'detail' || route.id !== selectedId.value) return;
const path = viewPath();
if (!path) return;
const now = `${window.location.pathname}${window.location.search}`;
if (now === path) return;
writeHistory(method, path);
}
// A visitor's change is a new history entry, so back undoes it. The
// entry is rewritten once the server has had its say (a conference the
// new age does not have is dropped, say).
const changeView = async change => {
const pending = change();
syncViewUrl('pushState');
try {
await pending;
} finally {
syncViewUrl('replaceState');
rememberView();
}
};
// Only a viewer's own change is remembered, never a load: opening another
// tournament must not overwrite what they picked on this one (SB-1905).
function rememberView() {
const path = viewPath();
if (!path || !isLargeTournament.value) return;
const at = path.indexOf('?');
const view = readTournamentQuery(at === -1 ? '' : path.slice(at));
viewMemory.save(tournamentViewToRemember(view, selectedId.value));
}
const onDay = day => changeView(() => tournamentMatches.setDay(day));
const onAge = id => changeView(() => tournamentMatches.setAgeGroup(id));
const onConference = id =>
changeView(() => tournamentMatches.setConference(id));
const onGroup = (key, option = null) =>
changeView(() => tournamentMatches.setGroup(key, option));
const onLeague = league =>
changeView(() => tournamentMatches.setLeague(league));
const onStage = key => changeView(() => tournamentMatches.setStage(key));
const onTeam = (team, ageGroupId = null) =>
changeView(() => tournamentMatches.selectTeam(team, ageGroupId));
const onTeamAge = ageGroupId =>
changeView(() => tournamentMatches.setTeamAge(ageGroupId));
// The selected team's ages, youngest first, for the switch (SB-1892).
const teamAges = computed(() =>
[...(selectedTeam.value?.age_groups || [])].sort(byAgeName)
);
const teamAgeId = computed(
() => tournamentMatches.selectedAgeGroupId.value
);
const onClearTeam = () => changeView(() => tournamentMatches.clearTeam());
// โโ who is viewing โโ
// A parent follows a club across age groups, so club is the primary
// identity and team is the fallback for accounts that only carry team_id.
// Signed out, both are null and every highlight silently switches off.
// `unref` rather than `.value`: the store exposes these as computed refs,
// but a caller (or a test double) may hand over plain ids, and an account
// with neither simply has none.
const myClubId = computed(() => unref(authStore.userClubId) ?? null);
const myTeamId = computed(() => unref(authStore.userTeamId) ?? null);
// โโ inline scoring โโ
// Scores arrive round by round during a tournament weekend, so the edit
// affordance lives on the row itself rather than behind the Admin panel.
// One row at a time is in flight; the id is what the row watches to know
// its own write finished.
const savingMatchId = ref(null);
const saveErrorMatchId = ref(null);
const saveError = ref('');
const canEditMatchRow = match =>
canEditMatch(match, {
isAdmin: unref(authStore.isAdmin),
isClubManager: unref(authStore.isClubManager),
isTeamManager: unref(authStore.isTeamManager),
clubId: myClubId.value,
teamId: myTeamId.value,
});
const applyMatchUpdate = updated => {
if (!selected.value?.matches || !updated?.id) return;
const index = selected.value.matches.findIndex(m => m.id === updated.id);
if (index === -1) return;
// Keep the row's display fields (nested team + club objects) โ the PATCH
// response carries the match, not the tournament view's joins.
selected.value.matches[index] = {
...selected.value.matches[index],
home_score: updated.home_score,
away_score: updated.away_score,
home_penalty_score: updated.home_penalty_score,
away_penalty_score: updated.away_penalty_score,
match_status: updated.match_status ?? updated.status,
};
selected.value = {
...selected.value,
matches: [...selected.value.matches],
};
};
// Realtime UPDATEs land in the same merge the inline editor uses: the
// payload carries raw `matches` columns, so the row's joined team and
// age-group objects have to survive it (SB-909).
useLiveRowSync(selectedMatches, applyMatchUpdate, {
onReturn: refreshSelected,
});
const saveScore = async payload => {
const match = payload?.match;
if (!match) return;
savingMatchId.value = match.id;
saveErrorMatchId.value = null;
saveError.value = '';
const body = {
home_score: payload.home_score,
away_score: payload.away_score,
// A score entered here is a result, not a plan. Anything already
// beyond "scheduled" (live, forfeit) keeps the status it has.
...(match.match_status === 'scheduled' || match.match_status == null
? { match_status: 'completed' }
: {}),
};
if (payload.home_penalty_score != null) {
body.home_penalty_score = payload.home_penalty_score;
body.away_penalty_score = payload.away_penalty_score;
}
try {
const updated = await authStore.apiRequest(
`${getApiBaseUrl()}/api/matches/${match.id}`,
{ method: 'PATCH', body: JSON.stringify(body) }
);
applyMatchUpdate(updated ?? { id: match.id, ...body });
} catch (err) {
saveErrorMatchId.value = match.id;
saveError.value = err?.message || 'Could not save the score.';
} finally {
savingMatchId.value = null;
}
};
// The filter input is only worth its row once the list is long enough to
// need it. Kept visible while a filter is active so it can be cleared.
// Not offered for a large tournament: it would search only the rows
// loaded so far and read as "this team is not here".
const showTeamFilter = computed(
() =>
!isLargeTournament.value &&
((selected.value?.matches?.length ?? 0) > TEAM_FILTER_THRESHOLD ||
!!teamFilter.value)
);
// The sections, each already sorted, then grouped into days. Empty
// sections drop out so a tournament with no knockout stage shows no
// "Knockout Rounds" heading over nothing.
//
// SB-1875: competition stages sit at the earliest round they play
// (`rank`); the round sections keep their own order, each just after the
// competitions of the round it starts at, so a tournament with no
// competition reads exactly as before.
const ROUND_SECTION_RANK = {
group: roundRank('group_stage') + 0.5,
showcase: roundRank('group_stage') + 0.6,
knockout: roundRank('round_of_32') + 0.5,
placement_final: roundRank('consolation') + 0.4,
consolation: roundRank('consolation') + 0.5,
untagged: Infinity,
};
const ranked = (rank, sections) => sections.map(s => ({ ...s, rank }));
const listSections = computed(() =>
[
// A competition played on the showcase round sits with the
// Showcase sections, where its rows were drawn before SB-1875.
...stageSplit.value.sections.map(s =>
s.rank === roundRank('showcase')
? { ...s, rank: ROUND_SECTION_RANK.showcase }
: s
),
...ranked(ROUND_SECTION_RANK.group, [
{
key: 'group',
title: 'Group Stage',
matches: groupStageMatches.value,
showRoundChip: false,
showGroupChip: true,
},
]),
...ranked(ROUND_SECTION_RANK.showcase, stageSections('showcase')),
...ranked(ROUND_SECTION_RANK.knockout, [
{
key: 'knockout',
title: 'Knockout Rounds',
matches: knockoutMatches.value,
showRoundChip: true,
showGroupChip: true,
},
]),
...ranked(
ROUND_SECTION_RANK.placement_final,
stageSections('placement_final')
),
...ranked(ROUND_SECTION_RANK.consolation, stageSections('consolation')),
...ranked(ROUND_SECTION_RANK.untagged, [
{
key: 'untagged',
title: 'Matches',
matches: untaggedMatches.value,
showRoundChip: false,
showGroupChip: false,
},
]),
]
// Stable: sections of one rank keep the order they were built in.
.sort((a, b) => a.rank - b.rank)
.filter(section => section.matches.length > 0)
.map(section => ({
...section,
days: groupMatchesByDay(section.matches),
}))
);
// Which part of the tournament is actually happening, for the status
// ribbon. Null when nothing is in flight โ the ribbon then shows only the
// tournament's own state rather than inventing a stage.
const stageLabel = computed(() => {
const matches = selected.value?.matches ?? [];
if (matches.length === 0) return null;
// 'live' is the stored status; 'in_progress' is an alias kept for older
// payloads. Matching only the alias meant a tournament with a match
// actually under way never counted as live (SB-910).
const live = matches.filter(m =>
['live', 'in_progress'].includes(m.match_status)
);
const pool = live.length > 0 ? live : matches;
const hasKnockout = pool.some(m =>
KNOCKOUT_ROUNDS.has(m.tournament_round)
);
const hasGroup = pool.some(m => m.tournament_round === 'group_stage');
if (hasKnockout && !hasGroup) return 'Knockout rounds';
if (hasGroup && !hasKnockout) return 'Group stage';
return null;
});
// True when the tournament has more than one age group represented in
// its matches โ drives whether each row should show the age-group chip.
// For single-age tournaments (e.g. NAC = U14-only) the chip is pure
// noise, since the tournament header already states the age group.
const showAgeChip = computed(() => availableAgeGroups.value.length > 1);
// โโ bracket-mode computed state โโ
// True when the selected tournament has at least one match tagged with
// a single-elimination bracket round (drives the List|Bracket toggle).
const hasBracketRounds = computed(() => {
const matches = selected.value?.matches ?? [];
return matches.some(m => BRACKET_ROUNDS.has(m.tournament_round));
});
const bracketAgeGroups = computed(() => {
const matches = selected.value?.matches ?? [];
const seen = new Map();
for (const m of matches) {
if (m.age_group && BRACKET_ROUNDS.has(m.tournament_round)) {
seen.set(m.age_group.id, m.age_group);
}
}
return [...seen.values()].sort((a, b) => a.name.localeCompare(b.name));
});
const bracketGroups = computed(() => {
const matches = selected.value?.matches ?? [];
const groups = new Set();
for (const m of matches) {
if (
BRACKET_ROUNDS.has(m.tournament_round) &&
(bracketAgeGroupId.value == null ||
m.age_group?.id === bracketAgeGroupId.value) &&
m.tournament_group
) {
groups.add(m.tournament_group);
}
}
// Stable order: Championship first if present, then alphabetical.
const arr = [...groups];
arr.sort((a, b) => {
if (a === 'Championship') return -1;
if (b === 'Championship') return 1;
return a.localeCompare(b);
});
return arr;
});
const bracketMatches = computed(() => {
const matches = selected.value?.matches ?? [];
return matches.filter(
m =>
BRACKET_ROUNDS.has(m.tournament_round) &&
(bracketAgeGroupId.value == null ||
m.age_group?.id === bracketAgeGroupId.value) &&
(bracketGroup.value == null ||
m.tournament_group === bracketGroup.value)
);
});
// Seed defaults when a tournament loads or its match set changes.
watch(
() => selected.value?.matches,
() => {
if (!hasBracketRounds.value) return;
if (
bracketAgeGroupId.value == null &&
bracketAgeGroups.value.length > 0
) {
bracketAgeGroupId.value = bracketAgeGroups.value[0].id;
}
if (bracketGroup.value == null && bracketGroups.value.length > 0) {
bracketGroup.value = bracketGroups.value[0];
}
},
{ immediate: true }
);
// If user changes age group and the prior bracket group isn't available
// for the new age group, fall back to the first available.
watch(bracketAgeGroupId, () => {
if (
bracketGroup.value != null &&
!bracketGroups.value.includes(bracketGroup.value)
) {
bracketGroup.value = bracketGroups.value[0] ?? null;
}
});
// โโ bracket follow toggle โโ
// A user can follow the currently-selected bracket (tournament + group +
// age group) to get a push at fulltime for every match in it. Gated on
// being signed in with push enabled, mirroring team-follow buttons.
//
// The same (tournament, group, age) tuple is selectable in two views:
// the knockout Bracket view (bracketGroup/bracketAgeGroupId) and the
// group-stage Standings view (standingsGroup/standingsAgeGroupId) โ e.g.
// NAC "Bracket A" is a group-stage pool that only renders in Standings.
// So we expose a follow toggle in BOTH, built from one factory.
const makeBracketFollow = (groupRef, ageRef) => {
const can = computed(
() =>
authStore.isAuthenticated.value &&
pushEnabled.value &&
selectedId.value != null &&
groupRef.value != null &&
ageRef.value != null
);
const isFollowed = computed(() =>
bracketFollows.isFollowing(
selectedId.value,
groupRef.value,
ageRef.value
)
);
const toggle = () => {
if (!can.value) return;
return bracketFollows.toggle(
selectedId.value,
groupRef.value,
ageRef.value
);
};
// A bracket is selected and the user is signed in, but push isn't on yet โ
// so `can` is false and the button is hidden. Surface a hint instead of
// showing nothing, pointing them at the profile to enable notifications.
const needsPush = computed(
() =>
authStore.isAuthenticated.value &&
!pushEnabled.value &&
selectedId.value != null &&
groupRef.value != null &&
ageRef.value != null
);
return { can, isFollowed, toggle, needsPush };
};
const bracketFollow = makeBracketFollow(bracketGroup, bracketAgeGroupId);
const canFollowBracket = bracketFollow.can;
const isBracketFollowed = bracketFollow.isFollowed;
const toggleBracketFollow = bracketFollow.toggle;
const bracketNeedsPush = bracketFollow.needsPush;
const standingsFollow = makeBracketFollow(
standingsGroup,
standingsAgeGroupId
);
const canFollowStandingsBracket = standingsFollow.can;
const isStandingsBracketFollowed = standingsFollow.isFollowed;
const toggleStandingsBracketFollow = standingsFollow.toggle;
const standingsNeedsPush = standingsFollow.needsPush;
// โโ standings-mode computed state โโ
// Same pattern as bracket-mode, but keyed off group_stage matches
// grouped by `tournament_group` (e.g. 'U14 Boys Diamond Bracket A').
const hasStandingsRounds = computed(() => {
const matches = selected.value?.matches ?? [];
return matches.some(
m => m.tournament_round === 'group_stage' && m.tournament_group
);
});
const standingsAgeGroups = computed(() => {
const matches = selected.value?.matches ?? [];
const seen = new Map();
for (const m of matches) {
if (
m.age_group &&
m.tournament_round === 'group_stage' &&
m.tournament_group
) {
seen.set(m.age_group.id, m.age_group);
}
}
return [...seen.values()].sort((a, b) => a.name.localeCompare(b.name));
});
const standingsGroups = computed(() => {
const matches = selected.value?.matches ?? [];
const groups = new Set();
for (const m of matches) {
if (
m.tournament_round === 'group_stage' &&
m.tournament_group &&
(standingsAgeGroupId.value == null ||
m.age_group?.id === standingsAgeGroupId.value)
) {
groups.add(m.tournament_group);
}
}
return [...groups].sort((a, b) => a.localeCompare(b));
});
const standingsMatches = computed(() => {
const matches = selected.value?.matches ?? [];
return matches.filter(
m =>
m.tournament_round === 'group_stage' &&
m.tournament_group &&
(standingsAgeGroupId.value == null ||
m.age_group?.id === standingsAgeGroupId.value) &&
(standingsGroup.value == null ||
m.tournament_group === standingsGroup.value)
);
});
watch(
() => selected.value?.matches,
() => {
if (!hasStandingsRounds.value) return;
if (
standingsAgeGroupId.value == null &&
standingsAgeGroups.value.length > 0
) {
standingsAgeGroupId.value = standingsAgeGroups.value[0].id;
}
if (standingsGroup.value == null && standingsGroups.value.length > 0) {
standingsGroup.value = standingsGroups.value[0];
}
},
{ immediate: true }
);
watch(standingsAgeGroupId, () => {
if (
standingsGroup.value != null &&
!standingsGroups.value.includes(standingsGroup.value)
) {
standingsGroup.value = standingsGroups.value[0] ?? null;
}
});
// Refetch tournaments whenever the season changes, and show that season's
// index. The default season set on mount is skipped โ onMounted fetches
// for it, and a second fetch would race the id from the URL.
watch(selectedSeasonId, (seasonId, previous) => {
if (previous == null) return;
if (seasonSetByLink) {
seasonSetByLink = false;
return;
}
navSeq += 1;
indexRequested = false;
indexNotice.value = null;
writeHistory('replaceState', tournamentPath());
fetchTournaments();
});
onMounted(async () => {
const route = currentRoute();
const wantedId = route?.kind === 'detail' ? route.id : null;
if (!route) {
// Entered from the tab bar: the address bar says where we are.
writeHistory('replaceState', tournamentPath());
}
window.addEventListener('popstate', onPopState);
const mountSeq = navSeq;
await fetchSeasons();
if (isUnmounted) return;
if (navSeq === mountSeq) {
await fetchTournaments(wantedId);
} else if (listSeq === 0) {
// Back / forward to the index while seasons loaded: that season's
// index, without the link that is no longer in the address bar.
await fetchTournaments();
}
if (isUnmounted) return;
bracketFollows.ensureLoaded();
});
// Leaving the tab: a reload of the next tab must not reopen a tournament.
// A path outside the tab (back to another page) is left as it is. After
// this, nothing still in flight writes the address bar or fetches.
onUnmounted(() => {
window.removeEventListener('popstate', onPopState);
if (currentRoute()) writeHistory('replaceState', '/');
isUnmounted = true;
});
return {
canFollowBracket,
isBracketFollowed,
toggleBracketFollow,
bracketNeedsPush,
canFollowStandingsBracket,
isStandingsBracketFollowed,
toggleStandingsBracketFollow,
standingsNeedsPush,
tournaments,
seasons,
selectedSeasonId,
formatSeasonDates,
loading,
error,
selectedId,
selected,
matchesLoading,
teamFilter,
ageGroupFilter,
availableAgeGroups,
filteredMatches,
groupStageMatches,
knockoutMatches,
untaggedMatches,
formatDayBand,
relativeDay,
myClubId,
myTeamId,
canEditMatchRow,
saveScore,
savingMatchId,
saveErrorMatchId,
saveError,
showTeamFilter,
listSections,
stageLabel,
selectTournament,
openTournament,
backToIndex,
indexNotice,
isLargeTournament,
viewedAgeGroupId,
filterAgeGroups: tournamentMatches.ageGroups,
filterGroups: tournamentMatches.groups,
selectedGroupKey: tournamentMatches.selectedGroup,
selectedGroupStage: tournamentMatches.selectedGroupStage,
filteredTotal: tournamentMatches.total,
hasMoreMatches: tournamentMatches.hasMore,
pageLoading: tournamentMatches.pageLoading,
loadingMore: tournamentMatches.loadingMore,
pageError: tournamentMatches.pageError,
largeEmptyText,
setAgeGroup: tournamentMatches.setAgeGroup,
setGroup: tournamentMatches.setGroup,
onDay,
onAge,
onConference,
onGroup,
onLeague,
onStage,
onTeam,
onTeamAge,
teamAges,
teamAgeId,
onClearTeam,
teamMode,
selectedTeam,
teamChipText,
teamDays,
leagueAllCount,
filterLeagues: tournamentMatches.leagues,
selectedLeague: tournamentMatches.selectedLeague,
filterStages: tournamentMatches.stages,
selectedStage: tournamentMatches.selectedStage,
filterUnstagedCount: tournamentMatches.unstagedCount,
emptyActions,
selectedDay,
selectedDayLong,
filterDays,
dayMode,
showDayStrip,
tournamentToday,
filterConferences: tournamentMatches.conferences,
selectedConferenceId: tournamentMatches.selectedConferenceId,
filterUnplaced: tournamentMatches.unplaced,
venueZone,
zoneLabel,
timeSlots,
isKnockoutRound,
loadMore: tournamentMatches.loadMore,
reloadPage: tournamentMatches.reloadPage,
todayMotds,
motdMatchIds,
viewMode,
hasBracketRounds,
bracketAgeGroups,
bracketAgeGroupId,
bracketGroups,
bracketGroup,
bracketMatches,
hasStandingsRounds,
standingsAgeGroups,
standingsAgeGroupId,
standingsGroups,
standingsGroup,
standingsMatches,
selectedMatchId,
viewMatch,
handleBackFromMatchDetail,
showAgeChip,
};
},
};
</script>
|