Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"eject": "react-scripts eject",
"lint": "eslint . --ext .ts --ext .tsx",
"lint:fix": "yarn lint --fix",
"tsc": "tsc -p tsconfig.json"
"tsc": "tsc -p tsconfig.json",
"postinstall": "patch-package"
},
"proxy": "http://localhost:8080",
"browserslist": {
Expand All @@ -56,6 +57,7 @@
]
},
"devDependencies": {
"@types/google-map-react": "^2.1.10"
"@types/google-map-react": "^2.1.10",
"patch-package": "^8.0.1"
}
}
13 changes: 13 additions & 0 deletions frontend/patches/react-scripts+4.0.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js b/node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js
index 00139ee..564d70a 100644
--- a/node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js
+++ b/node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js
@@ -179,7 +179,7 @@ function verifyTypeScriptSetup() {
throw new Error(ts.formatDiagnostic(error, formatDiagnosticHost));
}

- appTsConfig = readTsConfig;
+ appTsConfig = JSON.parse(JSON.stringify(readTsConfig));

// Get TS to parse and resolve any "extends"
// Calling this function also mutates the tsconfig above,
51 changes: 43 additions & 8 deletions frontend/src/pages/AdminPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ const AdminPage = (): ReactElement => {
>('idle');
const [migrationSummary, setMigrationSummary] = useState<any>(null);
const [migrationProgress, setMigrationProgress] = useState<string>('');
const [showMigrateConfirm, setShowMigrateConfirm] = useState(false);
const [migrateConfirmText, setMigrateConfirmText] = useState('');

// Create new apartment state
const [createModalOpen, setCreateModalOpen] = useState(false);
Expand Down Expand Up @@ -530,15 +532,13 @@ const AdminPage = (): ReactElement => {
}
};

const handleMigrationRun = async () => {
if (
!window.confirm(
'Are you sure you want to run the migration? This will modify ALL apartment records in the database.'
)
) {
return;
}
const handleMigrationRun = () => {
setMigrateConfirmText('');
setShowMigrateConfirm(true);
};

const handleMigrationRunConfirmed = async () => {
setShowMigrateConfirm(false);
try {
setMigrationStatus('running');
setMigrationProgress('Migrating apartments...');
Expand Down Expand Up @@ -1718,6 +1718,41 @@ const AdminPage = (): ReactElement => {
>
Run Migration
</Button>

{/* Confirm migration dialog */}
<Dialog
open={showMigrateConfirm}
onClose={() => setShowMigrateConfirm(false)}
maxWidth="sm"
fullWidth
>
<DialogTitle>Confirm Schema Migration</DialogTitle>
<DialogContent>
<Typography variant="body1" style={{ marginBottom: '16px' }}>
This will batch-write to <strong>every apartment record</strong> in the
database. This action cannot be undone. Type{' '}
<strong style={{ fontFamily: 'monospace' }}>CONFIRM</strong> to proceed.
</Typography>
<TextField
fullWidth
variant="outlined"
placeholder="Type CONFIRM"
value={migrateConfirmText}
onChange={(e) => setMigrateConfirmText(e.target.value)}
/>
</DialogContent>
<DialogActions>
<Button onClick={() => setShowMigrateConfirm(false)}>Cancel</Button>
<Button
variant="contained"
color="secondary"
disabled={migrateConfirmText !== 'CONFIRM'}
onClick={handleMigrationRunConfirmed}
>
Run Migration
</Button>
</DialogActions>
</Dialog>
</Box>

{/* Migration Progress */}
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/pages/ApartmentPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ import MapModal from '../components/Apartment/MapModal';
import LandlordMessagingModal from '../components/Apartment/LandlordMessagingModal';
import ConfirmLandlordMessagingModal from '../components/Apartment/ConfirmLandlordMessagingModal';
import DropDownWithLabel from '../components/utils/DropDownWithLabel';
import firebase from 'firebase/app';
import 'firebase/auth';
import AddToFolderPopover from '../components/Folder/AddToFolderPopover';

type Props = {
Expand Down
Loading