diff --git a/apps/playground-web/components/Playground/Playground.tsx b/apps/playground-web/components/Playground/Playground.tsx index be92aa2..bdf9011 100644 --- a/apps/playground-web/components/Playground/Playground.tsx +++ b/apps/playground-web/components/Playground/Playground.tsx @@ -10,24 +10,24 @@ export default function Playground() { return (
-
+
diff --git a/apps/playground-web/components/Playground/TerminalUI.tsx b/apps/playground-web/components/Playground/TerminalUI.tsx index d279b79..3311c53 100644 --- a/apps/playground-web/components/Playground/TerminalUI.tsx +++ b/apps/playground-web/components/Playground/TerminalUI.tsx @@ -15,7 +15,10 @@ export function TerminalUI({ initialCommandsLeft = 1000 }) { return ( <> -
+
@@ -24,7 +27,7 @@ export function TerminalUI({ initialCommandsLeft = 1000 }) {
@@ -50,26 +53,31 @@ function TerminalCounter({
- Cleanup in: {formatTime(cleanupTimeLeft)} mins + + + Cleanup in: + {formatTime(cleanupTimeLeft)} mins +
-
- Commands left: {commandsLeft} + {' '} + + Commands left: + {commandsLeft} +
- {' '} - {/* Tooltip next to text */}
-
+

DiceDB instance is shared across all users. diff --git a/apps/playground-web/components/Search/CommandPage.tsx b/apps/playground-web/components/Search/CommandPage.tsx index de7ddda..123a580 100644 --- a/apps/playground-web/components/Search/CommandPage.tsx +++ b/apps/playground-web/components/Search/CommandPage.tsx @@ -31,7 +31,7 @@ export default function CommandPage({ return (

{syntax} diff --git a/apps/playground-web/components/Search/SearchBox.tsx b/apps/playground-web/components/Search/SearchBox.tsx index 032521a..38bc99d 100644 --- a/apps/playground-web/components/Search/SearchBox.tsx +++ b/apps/playground-web/components/Search/SearchBox.tsx @@ -16,8 +16,11 @@ export default function SearchBox() { ); return ( -
-
+
+
-
- {search.length > 1 && - filteredCommands.map((cmdMeta) => ( - - ))} +
+ {filteredCommands.map((cmdMeta) => ( + + ))} + {filteredCommands.length === 0 && }
); } + +const NotFoundPage = () => { + return ( +
+

+ No matching data was found🥺 +

+ +
+

+ Try refining your search or browse the documentation for common + commands. +

+
+ + View Documentation + +
+ ); +}; diff --git a/apps/playground-web/components/Search/__tests__/SearchBox.test.tsx b/apps/playground-web/components/Search/__tests__/SearchBox.test.tsx index aebdfec..d6bd507 100644 --- a/apps/playground-web/components/Search/__tests__/SearchBox.test.tsx +++ b/apps/playground-web/components/Search/__tests__/SearchBox.test.tsx @@ -82,14 +82,15 @@ describe('SearchBox Component', () => { } }); - it('should not show results when search length is less than 2', async () => { + it('should show all commands when search length is 0', async () => { const { searchInputElement } = setupTest(); - await userEvent.type(searchInputElement, 'A'); - - Object.values(DiceCmds).forEach((cmd) => { - expect( - screen.queryByText(new RegExp(cmd.title, 'i')), - ).not.toBeInTheDocument(); - }); + expect(searchInputElement).toBeInTheDocument(); + const totalCommands = Object.values(DiceCmds).length; + const displayedCommands = Array.from( + screen + .getByTestId('search-container') + .querySelectorAll('[data-testid^="command-page"]'), + ); + expect(displayedCommands).toHaveLength(totalCommands); }); }); diff --git a/tooling/eslint-config/package.json b/tooling/eslint-config/package.json index c53bbfb..39e8164 100644 --- a/tooling/eslint-config/package.json +++ b/tooling/eslint-config/package.json @@ -8,12 +8,12 @@ "react-internal.js" ], "devDependencies": { + "@typescript-eslint/eslint-plugin": "^7.1.0", + "@typescript-eslint/parser": "^7.1.0", "@vercel/style-guide": "^5.2.0", - "eslint-config-turbo": "^2.0.0", "eslint-config-prettier": "^9.1.0", + "eslint-config-turbo": "^2.0.0", "eslint-plugin-only-warn": "^1.1.0", - "@typescript-eslint/parser": "^7.1.0", - "@typescript-eslint/eslint-plugin": "^7.1.0", "typescript": "^5.3.3" } }