Skip to content

Commit

Permalink
merge CDN changes
Browse files Browse the repository at this point in the history
  • Loading branch information
evanping committed Jul 30, 2024
1 parent 7e7ad97 commit 5f22746
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
28 changes: 28 additions & 0 deletions @empirica-mocks/core/mocks.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useContext } from 'react';
import { isFunctionDeclaration } from "typescript";
// import { StageContext } from '@/editor/stageContext'; # don't know why this doesn't work

// file is in deliberation-empirica/client/node_modules/@empirica/core/mocks.js
Expand Down Expand Up @@ -106,3 +107,30 @@ export function usePlayers() {

return players;
}

export function useGlobal() {
// This is a mock function that returns a mock global object
const global = {
isMock: true,
recruitingBatchConfig: {
cdn: 'local',
},
resourceLookup: {
cdn: 'local',
},
cdnList: {
test: "http://localhost:9091",
local: "http://localhost:9090",
prod: "https://s3.amazonaws.com/assets.deliberation-lab.org",
},
get: function (varName) {
return this[varName];
}
};
return global;
}

// Mock implementation of Loading
export function Loading() {
return "Loading...";
}
2 changes: 1 addition & 1 deletion @empirica-mocks/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"require": "./dist/player.cjs"
},
"./player/react": {
"import": "./react-mocks.js"
"import": "./mocks.js"
},
"./player/classic": {
"types": "./dist/player-classic.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/app/editor/components/CodeEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export default function CodeEditor() {
duration: 600,
desc: 'Main Discussion Time',
discussion: {
chatType: 'text',
showNickname: false,
showTitle: true,
},
Expand Down Expand Up @@ -117,6 +116,7 @@ export default function CodeEditor() {
localStorage.setItem('code', code)
window.location.reload() //refresh page to make elements appear on screen
} catch (YAMLParseError) {
console.log('Parse Error on Save', YAMLParseError)
//TODO also display a little something went wrong pop up
}
}
Expand Down

0 comments on commit 5f22746

Please sign in to comment.