Skip to content

Commit e24e212

Browse files
authored
Merge branch 'master' into release
2 parents 552f8fc + 4214c1f commit e24e212

6 files changed

Lines changed: 58 additions & 37 deletions

File tree

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
REACT_APP_API_URL=https://api.harmonydata.ac.uk
1+
REACT_APP_API_URL=https://api.harmonydata.ac.uk/
22
REACT_APP_API_EXAMPLES=$REACT_APP_API_URL/text/examples
33
REACT_APP_API_PARSE=$REACT_APP_API_URL/text/parse
44
REACT_APP_API_MATCH=$REACT_APP_API_URL/text/match

.env.development

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
REACT_APP_API_URL=https://harmonystagingtmp.azurewebsites.net/
1+
REACT_APP_API_URL=https://api.harmonydata.ac.uk/
22
REACT_APP_API_EXAMPLES=$REACT_APP_API_URL/text/examples
33
REACT_APP_API_PARSE=$REACT_APP_API_URL/text/parse
44
REACT_APP_API_MATCH=$REACT_APP_API_URL/text/match

src/components/App.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ import MakeMeJSON from "./MakeMeJSON.js";
3535
import "react-toastify/dist/ReactToastify.css";
3636
import YouTube from "react-youtube";
3737
import "../css/youtube.css";
38+
import { useHistory } from "react-router-dom";
3839

3940
function App() {
41+
const history = useHistory();
4042
const [fullscreen, setFullscreen] = useState(false);
4143
const [existingInstruments, setExistingInstruments] = useState([]);
4244
const [apiData, setApiData] = useState({});
@@ -152,7 +154,7 @@ function App() {
152154
setApiData(simpleApi);
153155
});
154156
},
155-
[match, fileInfos]
157+
[history, fileInfos]
156158
);
157159

158160
useEffect(() => {

src/components/AppBar.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,9 @@ function HarmonyAppBar() {
127127
</Box>
128128

129129
<Box sx={{ flexGrow: 0 }}>
130-
<Tooltip title="My Harmony">
130+
<Tooltip key="My Harmony" title="My Harmony">
131131
<Avatar
132+
key={(currentUser && currentUser.uid) || "anonUser"}
132133
src={currentUser && currentUser.photoURL}
133134
imgProps={{ referrerPolicy: "no-referrer" }}
134135
onClick={handleOpenUserMenu}
@@ -219,8 +220,11 @@ function HarmonyAppBar() {
219220
</MenuItem>
220221
))}
221222
{!currentUser && [
222-
<Divider />,
223-
<p style={{ margin: "0 0.5rem", textAlign: "center" }}>
223+
<Divider key="oauthSigninDiv" />,
224+
<p
225+
key="oauthSigninText"
226+
style={{ margin: "0 0.5rem", textAlign: "center" }}
227+
>
224228
Signing in with one of the OAuth providers below allows you
225229
access to My Harmony where you can save and share your
226230
harmonisations.
@@ -259,7 +263,7 @@ function HarmonyAppBar() {
259263
</Typography>
260264
</MenuItem>
261265
)}
262-
<Divider />
266+
<Divider key="versionDiv" />
263267
{apiVersion && (
264268
<Typography sx={{ mx: 1 }}>
265269
Harmony API version: {apiVersion}

src/conf/theme.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import "../css/Pragmatica.css";
22

3-
export const getDesignTokens = (mode) => ({
3+
export const getDesignTokens = (mode: string | undefined) => ({
44
typography: {
55
body1: {
66
fontFamily: "Pragmatica, sans-serif",
77
fontWeight: 300,
88
lineHeight: "150%",
99
fontSize: "0.9rem",
10-
"@media (min-width:600px)":{
10+
"@media (min-width:600px)": {
1111
fontSize: "1rem",
1212
},
13-
"@media (min-width:900px)":{
13+
"@media (min-width:900px)": {
1414
fontSize: "1.1rem",
15-
}
15+
},
1616
},
1717
caption: {
1818
fontFamily: "Pragmatica, sans-serif",
@@ -26,8 +26,8 @@ export const getDesignTokens = (mode) => ({
2626
},
2727
palette: {
2828
mode,
29-
...(mode === 'light'
30-
?{
29+
...(mode === "light"
30+
? {
3131
primary: {
3232
main: "#2b45ed",
3333
},
@@ -39,10 +39,10 @@ export const getDesignTokens = (mode) => ({
3939
paper: "#FEFCFB",
4040
},
4141
text: {
42-
primary: "#131854"
43-
}
44-
}:
45-
//Dark Mode
42+
primary: "#131854",
43+
},
44+
}
45+
: //Dark Mode
4646
{
4747
primary: {
4848
main: "#0de5b2",
@@ -55,10 +55,10 @@ export const getDesignTokens = (mode) => ({
5555
paper: "#131854",
5656
},
5757
text: {
58-
primary: "#FEFCFB"
59-
}
60-
})
61-
}
58+
primary: "#FEFCFB",
59+
},
60+
}),
61+
},
6262
});
6363

6464
export const getThemedComponents = (mode) => ({
@@ -101,18 +101,18 @@ export const getThemedComponents = (mode) => ({
101101
},
102102
},
103103
}),
104-
// Both Modes
105-
MuiInputBase: {
106-
styleOverrides: {
107-
root: {
108-
"& input": {
109-
"&:-webkit-autofill": {
110-
transition:
111-
"background-color 50000s ease-in-out 0s, color 50000s ease-in-out 0s",
112-
},
113-
},
104+
// Both Modes
105+
MuiInputBase: {
106+
styleOverrides: {
107+
root: {
108+
"& input": {
109+
"&:-webkit-autofill": {
110+
transition:
111+
"background-color 50000s ease-in-out 0s, color 50000s ease-in-out 0s",
114112
},
115113
},
116-
}
114+
},
115+
},
116+
},
117117
},
118118
});

src/contexts/DataContext.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,30 @@ export function DataProvider({ children }) {
7878
signal: controller.signal,
7979
});
8080
clearTimeout(id);
81+
// If successful, resolve immediately
82+
if (response.ok) {
83+
resolve(response.json());
84+
return; // Exit the loop and promise
85+
}
8186
} catch (e) {
82-
console.log(e);
83-
reject(e);
87+
console.log("Get rejection", e);
88+
// Only reject if there are no more retries
89+
if (retries === 0) {
90+
reject(e);
91+
}
8492
}
8593
retries--;
94+
if (retries > 0) {
95+
await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait 1 second
96+
}
97+
}
98+
// If the loop completes without a successful response, reject
99+
if (!(response && response.ok)) {
100+
reject(new Error("Failed to fetch data after multiple retries"));
86101
}
87-
resolve(response.json());
88102
});
89103
};
104+
90105
const parse = (allFiles) => {
91106
return retryablePostData({
92107
url: process.env.REACT_APP_API_PARSE,
@@ -120,14 +135,14 @@ export function DataProvider({ children }) {
120135
const getVersion = useCallback(() => {
121136
return retryableGetData({
122137
url: process.env.REACT_APP_API_VERSION,
123-
timeout: 1500,
138+
timeout: 2500,
124139
}).then((data) => data.harmony_version || "unknown");
125140
}, []);
126141

127142
const getModels = useCallback(() => {
128143
return retryableGetData({
129144
url: process.env.REACT_APP_API_MODELS,
130-
timeout: 1500,
145+
timeout: 2500,
131146
});
132147
}, []);
133148

0 commit comments

Comments
 (0)