-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
45 changed files
with
4,837 additions
and
4,337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
FROM node:alpine | ||
FROM node:alpine as builder | ||
WORKDIR /app | ||
COPY ./package*.json ./ | ||
RUN npm install | ||
COPY ./ ./ | ||
ENTRYPOINT npm start | ||
RUN npm run build | ||
# ENTRYPOINT npm start | ||
|
||
FROM nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Button from '@mui/material/Button' | ||
import { UserInfo } from './Users' | ||
import React, { useEffect, useState } from 'react' | ||
|
||
interface IProps { | ||
user: UserInfo | ||
} | ||
|
||
export default function User(props: IProps) { | ||
const [count, setCount] = useState<number>(0); | ||
|
||
const clickHandler = () => { | ||
console.log(count + 1); | ||
setCount(count + 1); | ||
} | ||
|
||
return ( | ||
<> | ||
<h3>Имя пользователя: {props.user.username}</h3> | ||
<h3>ФИО: {props.user.fullname}</h3> | ||
<h3>email: {props.user.email}</h3> | ||
<h3>Count: {count}</h3> | ||
<Button variant="contained" onClick={clickHandler}>Contained</Button> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import React, { useEffect, useState } from 'react' | ||
import User from './User' | ||
|
||
export interface UserInfo { | ||
id?: string | ||
username: string | ||
fullname: string | ||
email: string | ||
} | ||
|
||
const getUsers = async ():Promise<UserInfo[]> => { | ||
const resp = await fetch("/api/users"); | ||
const data = await resp.json(); | ||
return data; | ||
// console.log(data); | ||
|
||
// const users: UserInfo[] = | ||
// [ | ||
// { | ||
// id: "de1b01ad-c4aa-45d9-8147-c091ce89cd02", | ||
// username: "testuser", | ||
// fullname: "test", | ||
// email: "[email protected]" | ||
// }, | ||
// { | ||
// id: "de1b01ad-c4aa-45d9-8147-c091ce89cd01", | ||
// username: "testuser2", | ||
// fullname: "test2", | ||
// email: "[email protected]" | ||
// } | ||
// ] | ||
// const promise = new Promise<UserInfo[]>((res, rej) =>{ | ||
// setTimeout(()=>{ | ||
// res(users); | ||
// }, 5000) | ||
// }); | ||
// return promise; | ||
|
||
} | ||
|
||
|
||
export default function Users() { | ||
const [users, setUsers] = useState<UserInfo[]>([]); | ||
|
||
useEffect(()=>{ | ||
let isAlive = true; | ||
console.log('loading', isAlive); | ||
// const getData = async () =>{ | ||
// const data = await getUsers(); | ||
// if (isAlive) { | ||
// setUsers(data); | ||
// } | ||
// } | ||
// getData(); | ||
|
||
getUsers() | ||
.then( users =>{ isAlive && setUsers(users) }); | ||
|
||
|
||
return (()=> { | ||
console.log('deleting', isAlive); | ||
isAlive= false; | ||
}) | ||
},[]) | ||
|
||
return ( | ||
<div> | ||
{ | ||
users.map((user: UserInfo) => { | ||
return ( | ||
<User user={user} key={user.email}/> | ||
) | ||
}) | ||
} | ||
|
||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
import { ReportHandler } from 'web-vitals'; | ||
|
||
const reportWebVitals = (onPerfEntry?: ReportHandler) => { | ||
import { MetricType } from "web-vitals"; | ||
const reportWebVitals = (onPerfEntry?: (metric: MetricType) => void) => { | ||
if (onPerfEntry && onPerfEntry instanceof Function) { | ||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { | ||
getCLS(onPerfEntry); | ||
getFID(onPerfEntry); | ||
getFCP(onPerfEntry); | ||
getLCP(onPerfEntry); | ||
getTTFB(onPerfEntry); | ||
}); | ||
} | ||
}; | ||
import("web-vitals").then(({ onCLS, onINP, onFCP, onLCP, onTTFB }) => | ||
{ | ||
onCLS(onPerfEntry); | ||
onINP(onPerfEntry); | ||
onFCP(onPerfEntry); | ||
onLCP(onPerfEntry); | ||
onTTFB(onPerfEntry); | ||
}); | ||
} | ||
}; | ||
|
||
export default reportWebVitals; | ||
|
||
export default reportWebVitals; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.