Skip to content

Commit 509a189

Browse files
author
ist149372
committed
migrate to React 18
1 parent dabeda0 commit 509a189

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1123
-1386
lines changed

microfrontend-vite/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@
1414
"axios": "^0.25.0",
1515
"html-react-parser": "^1.4.8",
1616
"openseadragon": "^3.0.0",
17-
"react": "^17.0.2",
18-
"react-dom": "^17.0.2",
17+
"react": "^18.0.0-rc.3",
18+
"react-dom": "^18.0.0-rc.3",
1919
"react-modal": "^3.14.4",
2020
"react-router-dom": "^6.2.1",
2121
"react-tooltip": "^4.2.21",
2222
"zustand": "^3.6.9"
2323
},
2424
"devDependencies": {
2525
"@vitejs/plugin-react": "^1.0.7",
26+
"@vitejs/plugin-react-refresh": "^1.3.6",
2627
"vite": "^2.7.2"
2728
}
2829
}

microfrontend-vite/src/AppRouter.jsx

+8-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@ import NoPage from './pages/NoPage';
88
import Home from './microfrontends/home/Home';
99
import { getUser } from './microfrontends/user/api/users';
1010
import './resources/css/app.css';
11-
import { getToken, isAuthenticated, logout, setError, storeStateSelector } from './store';
11+
import {
12+
getToken,
13+
isAuthenticated,
14+
logout,
15+
setError,
16+
storeStateSelector,
17+
} from './store';
1218

1319
const UserRouter = lazy(() => import('./microfrontends/user/UserRouter'));
1420
const AboutRouter = lazy(() => import('./microfrontends/about/AboutRouter'));
@@ -26,7 +32,6 @@ const EditionRouter = lazy(() =>
2632
);
2733
const SearchRouter = lazy(() => import('./microfrontends/search/SearchRouter'));
2834

29-
3035
function App() {
3136
const navigate = useNavigate();
3237
const error = storeStateSelector('error');
@@ -37,9 +42,7 @@ function App() {
3742
setError();
3843
}, [error]);
3944

40-
41-
42-
useEffect(async () => {
45+
useEffect(() => {
4346
getToken() &&
4447
getUser()
4548
.then(() => isAuthenticated() && navigate('/', { replace: true }))

microfrontend-vite/src/customReact.js

Whitespace-only changes.

microfrontend-vite/src/main.jsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React from 'react';
2-
import ReactDOM from 'react-dom';
2+
import ReactDOM from 'react-dom/client';
33
import AppRouter from './AppRouter';
4-
import { BrowserRouter as Router } from 'react-router-dom'
4+
import { BrowserRouter as Router } from 'react-router-dom';
55

6+
const root = ReactDOM.createRoot(document.getElementById('root'));
67

7-
ReactDOM.render(
8+
root.render(
89
<Router basename={import.meta.env.VITE_BASE_PATH}>
9-
<AppRouter />
10-
</Router>,
11-
document.getElementById('root')
10+
<AppRouter />
11+
</Router>
1212
);

microfrontend-vite/src/microfrontends/about/AboutRouter.jsx

+49-23
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { Route, Routes } from 'react-router-dom';
2-
import { lazy } from 'react';
2+
import { lazy, Suspense } from 'react';
33
import './resources/about.css';
44
import messages from './resources/constants';
55

66
// TODO: dependecy from Home MFE
77
import HomeInfo from '../home/HomeInfo';
8-
import { storeStateSelector } from '../../store';
8+
import { getLanguage, storeStateSelector } from '../../store';
99

1010
const Archive = lazy(() => import('./pages/archive/Archive'));
1111
const Videos = lazy(() => import('./pages/videos/Videos'));
@@ -20,39 +20,65 @@ const Team = lazy(() => import('./pages/team/Team'));
2020
const Ack = lazy(() => import('./pages/Ack/Ack'));
2121
const Copyright = lazy(() => import('./pages/copyright/Copyright'));
2222

23+
const scroll = (ref) => {
24+
const section = document.querySelector(ref);
25+
section.scrollIntoView({ behavior: 'smooth', block: 'start' });
26+
};
2327

28+
const getLazyContact = (lang) => {
29+
const Contact = () => messages[lang]['contact'];
30+
return <Contact />;
31+
};
2432

2533
export default () => {
26-
const language = storeStateSelector('language')
27-
const Contact = () => messages?.[language]['contact'];
28-
29-
const scroll = (ref) => {
30-
const section = document.querySelector(ref);
31-
section.scrollIntoView({ behavior: 'smooth', block: 'start' });
32-
};
34+
const language = storeStateSelector('language');
3335

3436
return (
3537
<div className="ldod-default">
3638
<div className="container">
3739
<div className="col-md-8 col-md-offset-2 ldod-about">
3840
<Routes>
39-
<Route path="archive" element={<Archive />} />
40-
<Route path="videos" element={<Videos scroll={scroll} />} />
41-
<Route path="tutorials" element={<Tutorials scroll={scroll} />} />
42-
<Route path="faq" element={<Faq scroll={scroll} />} />
43-
<Route path="encoding" element={<Encoding />} />
44-
<Route path="articles" element={<Articles scroll={scroll} />} />
45-
<Route path="book" element={<Book />} />
46-
<Route path="conduct" element={<Conduct messages={messages} language={language}/>} />
47-
<Route path="privacy" element={<Privacy />} />
48-
<Route path="team" element={<Team />} />
49-
<Route path="acknowledgements" element={<Ack />} />
50-
<Route path="contact" element={<Contact />} />
51-
<Route path="copyright" element={<Copyright />} />
41+
<Route path="archive" element={<Archive language={language} />} />
42+
<Route
43+
path="videos"
44+
element={<Videos scroll={scroll} language={language} />}
45+
/>
46+
<Route
47+
path="tutorials"
48+
element={<Tutorials scroll={scroll} language={language} />}
49+
/>
50+
<Route
51+
path="faq"
52+
element={<Faq scroll={scroll} language={language} />}
53+
/>
54+
<Route path="encoding" element={<Encoding language={language} />} />
55+
<Route
56+
path="articles"
57+
element={<Articles scroll={scroll} language={language} />}
58+
/>
59+
<Route path="book" element={<Book language={language} />} />
60+
<Route
61+
path="conduct"
62+
element={<Conduct messages={messages} language={language} />}
63+
/>
64+
<Route path="privacy" element={<Privacy language={language} />} />
65+
<Route
66+
path="team"
67+
element={<Team scroll={scroll} language={language} />}
68+
/>
69+
<Route
70+
path="acknowledgements"
71+
element={<Ack language={language} />}
72+
/>
73+
<Route
74+
path="copyright"
75+
element={<Copyright language={language} />}
76+
/>
77+
<Route path="contact" element={<>{getLazyContact(language)}</>} />
5278
</Routes>
5379
</div>
5480
<div className="ldod-default col-md-8 col-md-offset-2 ldod-about">
55-
<HomeInfo info={messages[language].info} />
81+
<HomeInfo info={messages[getLanguage()].info} />
5682
</div>
5783
</div>
5884
<div className="bottom-bar"></div>

microfrontend-vite/src/microfrontends/about/pages/Ack/Ack-en.jsx

+20-38
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useEffect } from 'react';
22

3-
export default ({ posY, scroll }) => {
4-
useEffect(() => window.scrollTo({ top: posY }));
3+
export default ({ posY }) => {
4+
useEffect(() => window.scrollTo({ top: posY }), []);
55
return (
66
<>
77
<h1 className="text-center">Acknowledgements</h1>
@@ -85,8 +85,7 @@ export default ({ posY, scroll }) => {
8585
(FCSH): VI Seminar “
8686
<a
8787
href="http://elab.fcsh.unl.pt/actividades/estranhar-pessoa-vi-seminario"
88-
target="new"
89-
>
88+
target="new">
9089
Assuntos Materiais
9190
</a>
9291
,” organized by the Project “Estranhar Pessoa” (Februrary 7, 2013;
@@ -98,8 +97,7 @@ export default ({ posY, scroll }) => {
9897
organized by the Project “
9998
<a
10099
href="https://www.westernsydney.edu.au/writing_and_society/research/past_research_projects/creative_nation_writers_and_writing_in_the_new_media_culture"
101-
target="new"
102-
>
100+
target="new">
103101
Creative Nation: Writers and Writing in the New Media Culture
104102
</a>
105103
” (June 10, 2013; coords. Anna Gibbs and Maria Angel)
@@ -134,8 +132,7 @@ export default ({ posY, scroll }) => {
134132
modernes (ITEM): “
135133
<a
136134
href="https://textualscholarship.files.wordpress.com/2015/04/programme-ests-paris-conference-2013.pdf"
137-
target="new"
138-
>
135+
target="new">
139136
Variance in Textual Scholarship and Genetic Criticism/ La variance
140137
en philologie et dans la critique génétique
141138
</a>
@@ -151,8 +148,7 @@ export default ({ posY, scroll }) => {
151148
University of Coimbra, Biblioteca Geral: International Congress “
152149
<a
153150
href="http://www.uc.pt/bguc/500anos/Congresso_internacional"
154-
target="new"
155-
>
151+
target="new">
156152
A Biblioteca da Universidade: Permanências e Metamorfoses
157153
</a>
158154
” (January 16-18, 2014; coord. J. A. Cardoso Bernardes)
@@ -172,8 +168,7 @@ export default ({ posY, scroll }) => {
172168
Los Andes University, Bogotá: International conference “
173169
<a
174170
href="https://ilusionymaterialidad.wordpress.com/programa-2/"
175-
target="new"
176-
>
171+
target="new">
177172
Ilusión y materialidad de los archivos literarios
178173
</a>
179174
, ” organized by Universidad de los Andes, Instituto Caro y Cuervo
@@ -202,8 +197,7 @@ export default ({ posY, scroll }) => {
202197
University of Grenoble: Symposium “
203198
<a
204199
href="http://www.nedimah.eu/reports/toward-new-social-contract-between-publishers-and-editors"
205-
target="new"
206-
>
200+
target="new">
207201
Toward a New Social Contract between Publishers and Editors
208202
</a>
209203
,” organized by the Network for Digital Methods in the Arts and
@@ -215,8 +209,7 @@ export default ({ posY, scroll }) => {
215209
University of Rome La Sapienza: Symposium “
216210
<a
217211
href="http://www.disp.let.uniroma1.it/archivionotizie/ecd/dce-edizioni-confronto/comparing-editions"
218-
target="new"
219-
>
212+
target="new">
220213
Edizioni Critiche Digitali: Edizioni a Confronto / Digital
221214
Critical Editions: Comparing Editions
222215
</a>
@@ -229,8 +222,7 @@ export default ({ posY, scroll }) => {
229222
Arts: Symposium “
230223
<a
231224
href="https://willson.uga.edu/event/textual-machines-a-spring-symposium-exhibit/"
232-
target="new"
233-
>
225+
target="new">
234226
Textual Machines
235227
</a>
236228
” (April 17-18, 2015; coord. Jonathan Baillehache)
@@ -253,8 +245,7 @@ export default ({ posY, scroll }) => {
253245
University of Gothemburg, Center for Digital Humanities:{' '}
254246
<a
255247
href="http://cdh.hum.gu.se/Aktuellt/e/?eventId=2355210788"
256-
target="new"
257-
>
248+
target="new">
258249
Seminar
259250
</a>{' '}
260251
(September 24, 2015; coord. Jenny Bergenmar)
@@ -264,8 +255,7 @@ export default ({ posY, scroll }) => {
264255
(FCSH): International congress “
265256
<a
266257
href="https://congressohdpt.wordpress.com/programa/"
267-
target="new"
268-
>
258+
target="new">
269259
Humanidades Digitais em Portugal: Construir Pontes e Quebrar
270260
Barreiras na Era Digital
271261
</a>
@@ -276,23 +266,20 @@ export default ({ posY, scroll }) => {
276266
(CHSC): International conference “
277267
<a
278268
href="http://ahlist.org/conferences/2015-ahlist-coimbra/program/"
279-
target="new"
280-
>
269+
target="new">
281270
Consilience and Inclusion: Scientific and Cultural Encounters
282271
</a>
283272
<a
284273
href="http://ahlist.org/conferences/2015-ahlist-coimbra/"
285-
target="new"
286-
></a>
274+
target="new"></a>
287275
,” organized by the Association of History, Literature, Science, and
288276
Technology (November 19-21, 2015; coord. Yonsoo Kim)
289277
</li>
290278
<li>
291279
University of Coimbra, School of Economics: Colloquium “
292280
<a
293281
href="https://www.uc.pt/feuc/noticias/2015/novembro15/20151123"
294-
target="new"
295-
>
282+
target="new">
296283
On/Off: Navegando pelas Culturas Digitais, Tecnologia e
297284
Conhecimento
298285
</a>
@@ -329,8 +316,7 @@ export default ({ posY, scroll }) => {
329316
University of Pisa, Informatica Umanistica:{' '}
330317
<a
331318
href="http://www.labcd.unipi.it/seminari/silvestre-a-digital-archive-of-fernando-pessoa/"
332-
target="new"
333-
>
319+
target="new">
334320
Seminario di Cultura Digitale
335321
</a>{' '}
336322
(December 7, 2016; coord. Enrica Salvatori)
@@ -342,8 +328,7 @@ export default ({ posY, scroll }) => {
342328
University of Lisbon, School of Arts and Humanities:{' '}
343329
<a
344330
href="http://www.letras.ulisboa.pt/pt/agenda/conferencia-reimaginar-a-edicao-digital-no-arquivo-livro-do-desassossego"
345-
target="new"
346-
>
331+
target="new">
347332
Lecture for the Program in Textual Criticism
348333
</a>
349334
(January 24, 2017; coords. Esperança Cardeira, Cristina Sobral and
@@ -354,8 +339,7 @@ export default ({ posY, scroll }) => {
354339
and Information Studies:{' '}
355340
<a
356341
href="https://is.gseis.ucla.edu/research/colloquium/"
357-
target="new"
358-
>
342+
target="new">
359343
Colloquium: Breslauer lecture series
360344
</a>{' '}
361345
(February 2, 2017; coord. Johanna Drucker)
@@ -364,8 +348,7 @@ export default ({ posY, scroll }) => {
364348
Calouste Gulbenkian Foundation:{' '}
365349
<a
366350
href="http://casafernandopessoa.cm-lisboa.pt/fileadmin/CASA_FERNANDO_PESSOA/AF_CFP_Congresso_Internacional_FP_2017_Programa_Digital_V3.pdf"
367-
target="new"
368-
>
351+
target="new">
369352
IV Congresso Internacional Fernando Pessoa
370353
</a>
371354
, organizaed by Casa Fernando Pessoa (February 9-11, 2017; coord.
@@ -375,8 +358,7 @@ export default ({ posY, scroll }) => {
375358
Fernando Pessoa University, Porto: International conference “
376359
<a
377360
href="https://conference.eliterature.org/2017/conference"
378-
target="new"
379-
>
361+
target="new">
380362
ELO 2017: Affiliations, Communities, Translations
381363
</a>
382364
” (July 18-22, 2017; coords. Rui Torres and Sandy Baldwin)

0 commit comments

Comments
 (0)