Repository: codalab/codalab-worksheets (language: python)

Issue:
Make wide screen view the default for all users, so it would save the state when people go back
Create a new key in localstorage to store this preference (default to Y)


Discussion / hints:

Fix patch:
diff --git a/frontend/src/components/worksheets/Worksheet/Worksheet.js b/frontend/src/components/worksheets/Worksheet/Worksheet.js
index 30c205905..9fdfa698c 100644
--- a/frontend/src/components/worksheets/Worksheet/Worksheet.js
+++ b/frontend/src/components/worksheets/Worksheet/Worksheet.js
@@ -16,7 +16,7 @@ import {
     NAVBAR_HEIGHT,
     HEADER_HEIGHT,
     EXPANDED_WORKSHEET_WIDTH,
-    DEFAULT_WORKSHEET_WIDTH,
+    NARROW_WORKSHEET_WIDTH,
     LOCAL_STORAGE_WORKSHEET_WIDTH,
     DIALOG_TYPES,
     AUTO_HIDDEN_DURATION,
@@ -98,7 +98,7 @@ class Worksheet extends React.Component {
             deleteItemCallback: null,
             copiedBundleIds: '',
             showPasteButton: window.localStorage.getItem('CopiedBundles') !== '',
-            worksheetWidthPercentage: localWorksheetWidthPreference || DEFAULT_WORKSHEET_WIDTH,
+            worksheetWidthPercentage: localWorksheetWidthPreference || EXPANDED_WORKSHEET_WIDTH,
             messagePopover: {
                 showMessage: false,
                 messageContent: null,
@@ -847,9 +847,9 @@ class Worksheet extends React.Component {
     };
     toggleWorksheetSize = () => {
         let newPercentage =
-            this.state.worksheetWidthPercentage === DEFAULT_WORKSHEET_WIDTH
+            this.state.worksheetWidthPercentage === NARROW_WORKSHEET_WIDTH
                 ? EXPANDED_WORKSHEET_WIDTH
-                : DEFAULT_WORKSHEET_WIDTH;
+                : NARROW_WORKSHEET_WIDTH;
         window.localStorage.setItem(LOCAL_STORAGE_WORKSHEET_WIDTH, newPercentage);
         this.setState({ worksheetWidthPercentage: newPercentage });
     };
diff --git a/frontend/src/constants.js b/frontend/src/constants.js
index f9eb3bf63..79c35b8cd 100644
--- a/frontend/src/constants.js
+++ b/frontend/src/constants.js
@@ -9,10 +9,10 @@ export const HEADER_HEIGHT = 170;
 
 // Worksheet width
 export const EXPANDED_WORKSHEET_WIDTH = '99%';
-export const DEFAULT_WORKSHEET_WIDTH = '65%';
+export const NARROW_WORKSHEET_WIDTH = '65%';
 export const FILE_SIZE_LIMIT_GB = 2;
 export const FILE_SIZE_LIMIT_B = FILE_SIZE_LIMIT_GB * 1024 * 1024 * 1024;
-export const LOCAL_STORAGE_WORKSHEET_WIDTH = 'worksheetWidth';
+export const LOCAL_STORAGE_WORKSHEET_WIDTH = 'newWorksheetWidth';
 
 // Dialog constants
 export const DIALOG_TYPES = {


Test patch:
diff --git a/frontend/src/__tests__/__snapshots__/Worksheet.test.js.snap b/frontend/src/__tests__/__snapshots__/Worksheet.test.js.snap
index f926320a0..06e9139ab 100644
--- a/frontend/src/__tests__/__snapshots__/Worksheet.test.js.snap
+++ b/frontend/src/__tests__/__snapshots__/Worksheet.test.js.snap
@@ -606,7 +606,7 @@ Object {
           >
             <div
               class="Worksheet-worksheetOuter-2"
-              style="width: 65%;"
+              style="width: 99%;"
             >
               <div
                 class="Worksheet-worksheetDummyHeader-4"
@@ -1441,7 +1441,7 @@ Object {
         >
           <div
             class="Worksheet-worksheetOuter-2"
-            style="width: 65%;"
+            style="width: 99%;"
           >
             <div
               class="Worksheet-worksheetDummyHeader-4"