|
1 | 1 | 'use client'; |
2 | 2 |
|
3 | 3 | import Image from 'next/image'; |
| 4 | +import { Dice1, Dice3, Dice5, Info } from 'lucide-react'; |
| 5 | + |
| 6 | +// Components |
| 7 | +import Shell from '@/components/Shell/Shell'; |
4 | 8 | import SearchBox from '@/components/Search/SearchBox'; |
5 | | -import { TerminalUI } from './TerminalUI'; |
6 | 9 |
|
7 | 10 | // utils |
| 11 | +import { formatTime } from '@/shared/utils/commonUtils'; |
| 12 | +import { usePlayground } from './hooks/usePlayground'; |
8 | 13 |
|
9 | 14 | export default function Playground() { |
| 15 | + const { decreaseCommandsLeft, search, timeLeft, commandsLeft, setSearch } = |
| 16 | + usePlayground(); |
| 17 | + |
10 | 18 | return ( |
11 | 19 | <div className="container mx-auto flex flex-col flex-grow min-h-screen bg-white text-gray-900"> |
12 | | - <Header /> |
| 20 | + <header className="navbar flex items-center justify-between py-5"> |
| 21 | + <div className="flex items-center"> |
| 22 | + <Image |
| 23 | + src="/images/dicedb-logo-light.png" |
| 24 | + width={110} |
| 25 | + height={110} |
| 26 | + priority={true} |
| 27 | + alt="DiceDB logo" |
| 28 | + className="object-contain" |
| 29 | + unoptimized |
| 30 | + /> |
| 31 | + <h2 className="font-light text-2xl ml-2">PlayGround</h2> |
| 32 | + </div> |
| 33 | + </header> |
13 | 34 |
|
14 | 35 | <main className="flex flex-col lg:flex-row gap-10 flex-grow overflow-hidden px-4"> |
15 | 36 | <div className="w-full lg:w-7/12 flex flex-col"> |
16 | | - <TerminalUI /> |
| 37 | + <div className="bg-gray-900 rounded-lg"> |
| 38 | + <div className="bg-gray-900 px-4 py-4 flex items-center rounded-lg"> |
| 39 | + <div className="flex space-x-2"> |
| 40 | + <Dice5 className="w-4 h-4 bg-red-500" /> |
| 41 | + <Dice1 className="w-4 h-4 bg-yellow-500" /> |
| 42 | + <Dice3 className="w-4 h-4 bg-green-500" /> |
| 43 | + </div> |
| 44 | + </div> |
| 45 | + <div className="h-64 md:h-[30rem] bg-gray-100 rounded-lg overflow-hidden shadow-md"> |
| 46 | + <Shell decreaseCommandsLeft={decreaseCommandsLeft} /> |
| 47 | + </div> |
| 48 | + </div> |
| 49 | + |
| 50 | + <div className="flex flex-col"> |
| 51 | + <div className="flex flex-row justify-between text-gray-900 mt-4"> |
| 52 | + <div className="flex justify-between border border-gray-400 text-sm bg-transparent p-3 rounded-lg"> |
| 53 | + <span>Cleanup in : {formatTime(timeLeft)} mins</span> |
| 54 | + </div> |
| 55 | + <div className="flex justify-between border border-gray-400 text-sm bg-transparent p-3 rounded-lg"> |
| 56 | + <span>Commands left: {commandsLeft}</span> |
| 57 | + </div> |
| 58 | + </div> |
| 59 | + <div className="flex flex-row items-start mt-5"> |
| 60 | + <Info className="w-4 h-4 text-gray-500 mr-1" /> |
| 61 | + <p className="text-sm text-gray-500"> |
| 62 | + DiceDB instance is shared across all users. |
| 63 | + </p> |
| 64 | + </div> |
| 65 | + </div> |
17 | 66 | </div> |
| 67 | + |
18 | 68 | <div className="w-full lg:w-5/12 flex flex-col"> |
19 | 69 | <div className="flex-grow border border-gray-400 bg-gray-100 p-4 rounded-lg shadow-md mb-4"> |
20 | | - <SearchBox /> |
| 70 | + <SearchBox search={search} setSearch={setSearch} /> |
21 | 71 | </div> |
22 | 72 | </div> |
23 | 73 | </main> |
24 | 74 | </div> |
25 | 75 | ); |
26 | 76 | } |
27 | | - |
28 | | -function Header() { |
29 | | - return ( |
30 | | - <header className="navbar flex items-center justify-between py-5"> |
31 | | - <div className="flex items-center"> |
32 | | - <Image |
33 | | - src="/images/dicedb-logo-light.png" |
34 | | - width={110} |
35 | | - height={110} |
36 | | - priority={true} |
37 | | - alt="DiceDB logo" |
38 | | - className="object-contain" |
39 | | - unoptimized |
40 | | - /> |
41 | | - <h2 className="font-light text-2xl ml-2">PlayGround</h2> |
42 | | - </div> |
43 | | - </header> |
44 | | - ); |
45 | | -} |
|
0 commit comments