@samitouri / QOS-React / commits / b6c01f7f78

Remove playground wipe button

It was never clear to me what the difference between Wipe and Reset was. Let's just get rid of one and reset to something more useful instead of fibonacci. ghstack-source-id: 4f88a1c1da2d0fd9e1f26e4859c12db0fc961af2 Pull Request resolved: https://github.com/facebook/react-forget/pull/2837

Lauren Tan committed Apr 10, 2024 at 17:46 UTC b6c01f7f787917bda4b74c3d21206b2ff148c140
2 files changed +4 -38
compiler/apps/playground/components/Header.tsx
+2 -17
@@ -5,12 +5,12 @@
5 * LICENSE file in the root directory of this source tree.
6 */
7
8 -import { RefreshIcon, ShareIcon, TrashIcon } from "@heroicons/react/outline";
8 +import { RefreshIcon, ShareIcon } from "@heroicons/react/outline";
9 import { CheckIcon } from "@heroicons/react/solid";
10 import clsx from "clsx";
11 import { useSnackbar } from "notistack";
12 import { useState } from "react";
13 -import { defaultStore, minimalStore } from "../lib/defaultStore";
13 +import { defaultStore } from "../lib/defaultStore";
14 import Logo from "./Logo";
15 import { useStoreDispatch } from "./StoreContext";
16
@@ -33,13 +33,6 @@ export default function Header() {
33 }
34 };
35
36 - const handleWipe = () => {
37 - if (confirm("Are you sure you want to wipe the playground?")) {
38 - closeSnackbar();
39 - dispatchStore({ type: "setStore", payload: { store: minimalStore } });
40 - }
41 - };
42 -
36 const handleShare = () => {
37 navigator.clipboard.writeText(location.href).then(() => {
38 enqueueSnackbar("URL copied to clipboard");
@@ -61,14 +54,6 @@ export default function Header() {
54 <p className="hidden select-none sm:block">React Compiler Playground</p>
55 </div>
56 <div className="flex items-center text-[15px] gap-4">
64 - <button
65 - title="Wipe Playground"
66 - className="flex items-center gap-1 transition-colors duration-150 ease-in text-secondary hover:text-link"
67 - onClick={handleWipe}
68 - >
69 - <TrashIcon className="w-5 h-5" />
70 - <p className="hidden sm:block">Wipe</p>
71 - </button>
57 <button
58 title="Reset Playground"
59 className="flex items-center gap-1 transition-colors duration-150 ease-in text-secondary hover:text-link"
compiler/apps/playground/lib/defaultStore.ts
+2 -21
@@ -5,35 +5,16 @@
5 * LICENSE file in the root directory of this source tree.
6 */
7
8 -
8 import type { Store } from "./stores";
9
10 const index = `\
12 -function fibbonacci(n) {
13 - let a = 0;
14 - let b = 1;
15 - let c = 1;
16 - for (let i = 0; i < n; i++) {
17 - a = b;
18 - b = c;
19 - c = a + b;
20 - }
21 - return a;
22 -}
23 -`;
24 -
25 -export const defaultStore: Store = {
26 - source: index,
27 -};
28 -
29 -const minimalIndex = `\
11 export default function MyApp() {
12 return <div>Hello World</div>;
13 }
14 `;
15
35 -export const minimalStore: Store = {
36 - source: minimalIndex,
16 +export const defaultStore: Store = {
17 + source: index,
18 };
19
20 export const emptyStore: Store = {