From 48418b4d9cd2ca0866349b0e7f13358be63fc660 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sat, 28 Jun 2025 10:39:04 +0200 Subject: [PATCH 1/3] Improvements to missing language scope page --- .../contributing/MissingLanguageScopes.tsx | 40 ++++++++++++++----- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/packages/cursorless-org-docs/src/docs/contributing/MissingLanguageScopes.tsx b/packages/cursorless-org-docs/src/docs/contributing/MissingLanguageScopes.tsx index 1afbd9467f..3dc324417e 100644 --- a/packages/cursorless-org-docs/src/docs/contributing/MissingLanguageScopes.tsx +++ b/packages/cursorless-org-docs/src/docs/contributing/MissingLanguageScopes.tsx @@ -7,7 +7,7 @@ import { type ScopeType, type SimpleScopeTypeType, } from "@cursorless/common"; -import React from "react"; +import React, { useState } from "react"; export function MissingLanguageScopes(): React.JSX.Element[] { return Object.keys(languageScopeSupport) @@ -36,6 +36,11 @@ function Language({ return ( <>

{languageId}

+

+ + languages/{languageId} + +

{renderFacets("Unsupported", unsupportedFacets)} {renderFacets("Unspecified", unspecifiedFacets)} @@ -46,6 +51,8 @@ function renderFacets( title: string, facets: ScopeSupportFacet[], ): React.JSX.Element | null { + const [open, setOpen] = useState(false); + const scopes = Array.from( new Set( facets.map((f) => @@ -58,15 +65,30 @@ function renderFacets( return null; } + const renderBody = () => { + if (!open) { + return null; + } + + return ( +
+ +
+ ); + }; + return ( - <> - {title} ({scopes.length}) - - +
+
setOpen(!open)}> + {title} ({scopes.length}) +
+ + {renderBody()} +
); } From b23f3cb6764299aba011848fe4d350061dd80c3d Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sat, 28 Jun 2025 10:47:51 +0200 Subject: [PATCH 2/3] Open small cards by default --- .../contributing/MissingLanguageScopes.tsx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/cursorless-org-docs/src/docs/contributing/MissingLanguageScopes.tsx b/packages/cursorless-org-docs/src/docs/contributing/MissingLanguageScopes.tsx index 3dc324417e..1064ceac74 100644 --- a/packages/cursorless-org-docs/src/docs/contributing/MissingLanguageScopes.tsx +++ b/packages/cursorless-org-docs/src/docs/contributing/MissingLanguageScopes.tsx @@ -7,7 +7,7 @@ import { type ScopeType, type SimpleScopeTypeType, } from "@cursorless/common"; -import React, { useState } from "react"; +import React, { useEffect, useState } from "react"; export function MissingLanguageScopes(): React.JSX.Element[] { return Object.keys(languageScopeSupport) @@ -52,14 +52,19 @@ function renderFacets( facets: ScopeSupportFacet[], ): React.JSX.Element | null { const [open, setOpen] = useState(false); + const [scopes, setScopes] = useState([]); - const scopes = Array.from( - new Set( - facets.map((f) => - serializeScopeType(scopeSupportFacetInfos[f].scopeType), + useEffect(() => { + const scopes = Array.from( + new Set( + facets.map((f) => + serializeScopeType(scopeSupportFacetInfos[f].scopeType), + ), ), - ), - ).sort(); + ).sort(); + setScopes(scopes); + setOpen(scopes.length < 4); + }, []); if (scopes.length === 0) { return null; From 352b96808c74f751c997f05f938f2ac6821d57c1 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sat, 28 Jun 2025 11:01:16 +0200 Subject: [PATCH 3/3] Moved link --- .../src/docs/contributing/MissingLanguageScopes.tsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/cursorless-org-docs/src/docs/contributing/MissingLanguageScopes.tsx b/packages/cursorless-org-docs/src/docs/contributing/MissingLanguageScopes.tsx index 1064ceac74..b09f4d168b 100644 --- a/packages/cursorless-org-docs/src/docs/contributing/MissingLanguageScopes.tsx +++ b/packages/cursorless-org-docs/src/docs/contributing/MissingLanguageScopes.tsx @@ -35,12 +35,13 @@ function Language({ return ( <> -

{languageId}

-

- - languages/{languageId} - -

+

+ {languageId} + + + link + +

{renderFacets("Unsupported", unsupportedFacets)} {renderFacets("Unspecified", unspecifiedFacets)}