Skip to content

Commit

Permalink
renaming stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfig committed Mar 12, 2024
1 parent a8afca2 commit 2d95765
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,4 +266,4 @@ Output will be located in the terminal.

# Prompting user after version change

The current version numbers are stored in `minVersion.json`. This JSON is ready by both the client and the multiplayer server. When the client has a lower version number then the multiplayer (the version is sent by the multiplayer server with the EnterFileRoom message), then the user is prompted to refresh with slightly different experience based on required vs. recommended changes.
The current version numbers are stored in `updateAlertVersion.json`. This JSON is ready by both the client and the multiplayer server. When the client has a lower version number then the multiplayer (the version is sent by the multiplayer server with the EnterFileRoom message), then the user is prompted to refresh with slightly different experience based on required vs. recommended changes.
10 changes: 5 additions & 5 deletions quadratic-client/src/multiplayer/multiplayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { displayName } from '@/utils/userUtil';
import { pythonWebWorker } from '@/web-workers/pythonWebWorker/python';
import { User } from '@auth0/auth0-spa-js';
import { v4 as uuid } from 'uuid';
import sharedConstants from '../../../minVersion.json';
import sharedConstants from '../../../updateAlertVersion.json';
import { MULTIPLAYER_COLORS, MULTIPLAYER_COLORS_TINT } from '../gridGL/HTMLGrid/multiplayerCursor/multiplayerColors';
import {
Heartbeat,
Expand Down Expand Up @@ -57,7 +57,7 @@ export class Multiplayer {
private jwt?: string | void;
private lastMouseMove: { x: number; y: number } | undefined;
private connectionTimeout: number | undefined;
private minVersion: Version;
private updateAlertVersion: Version;

brokenConnection = false;

Expand Down Expand Up @@ -102,7 +102,7 @@ export class Multiplayer {
};
window.addEventListener('beforeunload', alertUser);

this.minVersion = sharedConstants;
this.updateAlertVersion = sharedConstants;
}

get state() {
Expand Down Expand Up @@ -387,9 +387,9 @@ export class Multiplayer {

// updates the React hook to populate the Avatar list
private receiveUsersInRoom(room: ReceiveRoom) {
if (room.min_version.requiredVersion > this.minVersion.requiredVersion) {
if (room.min_version.requiredVersion > this.updateAlertVersion.requiredVersion) {
window.dispatchEvent(new CustomEvent('need-refresh', { detail: 'required' }));
} else if (room.min_version.recommendedVersion > this.minVersion.recommendedVersion) {
} else if (room.min_version.recommendedVersion > this.updateAlertVersion.recommendedVersion) {
window.dispatchEvent(new CustomEvent('need-refresh', { detail: 'recommended' }));
}
const remaining = new Set(this.users.keys());
Expand Down
4 changes: 2 additions & 2 deletions quadratic-client/src/ui/QuadraticUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { focusGrid } from '../helpers/focusGrid';
import { isEmbed } from '../helpers/isEmbed';
import CodeEditor from '../ui/menus/CodeEditor';
import TopBar from '../ui/menus/TopBar';
import { VersionControlAlert } from './VersionControl';
import { UpdateAlertVersion } from './UpdateAlertVersion';
import { useFileContext } from './components/FileProvider';
import { FileUploadWrapper } from './components/FileUploadWrapper';
import { Following } from './components/Following';
Expand Down Expand Up @@ -103,7 +103,7 @@ export default function QuadraticUI() {
)}
{presentationMode && <PresentationModeHint />}
{!isEmbed && <PermissionOverlay />}
<VersionControlAlert />
<UpdateAlertVersion />
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { RocketIcon } from '@radix-ui/react-icons';
import { useEffect, useState } from 'react';
import { FixedBottomAlert } from './components/PermissionOverlay';

export const VersionControlAlert = () => {
export const UpdateAlertVersion = () => {
const [showDialog, setShowDialog] = useState<false | 'recommended' | 'required'>(false);
useEffect(() => {
const needRefresh = (message: any /* { detail: 'required' | 'recommended' } */) => setShowDialog(message.detail);
Expand Down
6 changes: 3 additions & 3 deletions quadratic-multiplayer/src/message/min_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use serde::{Deserialize, Serialize};

const FILE_MIN_VERSION: &str = "../minVersion.json";
const FILE_MIN_VERSION: &str = "../updateAlertVersion.json";

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
#[serde(rename_all = "camelCase")]
Expand All @@ -16,8 +16,8 @@ pub struct MinVersion {

impl MinVersion {
pub fn load() -> Self {
let file =
std::fs::read_to_string(FILE_MIN_VERSION).expect("Unable to read ../minVersion.json");
let file = std::fs::read_to_string(FILE_MIN_VERSION)
.expect("Unable to read ../updateAlertVersion.json");
serde_json::from_str(&file).expect("Unable to parse JSON")
}
}
Expand Down
File renamed without changes.

0 comments on commit 2d95765

Please sign in to comment.