Compare commits
No commits in common. "master" and "fix/link-update" have entirely different histories.
master
...
fix/link-u
0
.dockerignore
Executable file → Normal file
8
.env.development
Executable file → Normal file
@ -1,6 +1,6 @@
|
|||||||
REACT_APP_CMS_BASE_URL=http://scipaper.ru
|
REACT_APP_CMS_BASE_URL=https://cms.techpal.ru/api
|
||||||
REACT_APP_CMS_APP_NAME=scipaper
|
REACT_APP_CMS_APP_NAME=techpal
|
||||||
REACT_APP_OPENID_PROVIDER_URL=http://auth.techpal.ru/auth/realms/master/protocol/openid-connect/auth?client_id=techpal&response_type=code
|
REACT_APP_OPENID_PROVIDER_URL=http://auth.techpal.ru/auth/realms/master/protocol/openid-connect/auth?client_id=techpal&response_type=code
|
||||||
REACT_APP_INTEGRATOR_URL=http://scipaper.ru
|
REACT_APP_INTEGRATOR_URL=http://integrator.techpal.ru
|
||||||
REACT_APP_INTEGRATOR_API_VERSION=/v1
|
REACT_APP_INTEGRATOR_API_VERSION=/api/1
|
||||||
REACT_APP_GRAPHQL_URL=/graphql
|
REACT_APP_GRAPHQL_URL=/graphql
|
||||||
|
12
.env.production
Executable file → Normal file
@ -1,6 +1,6 @@
|
|||||||
REACT_APP_CMS_BASE_URL=http://scipaper.ru
|
REACT_APP_CMS_BASE_URL=EXT_CMS_BASE_URL
|
||||||
REACT_APP_CMS_APP_NAME=scipaper
|
REACT_APP_CMS_APP_NAME=EXT_CMS_APP_NAME
|
||||||
REACT_APP_OPENID_PROVIDER_URL=http://auth.techpal.ru/auth/realms/master/protocol/openid-connect/auth?client_id=techpal&response_type=code
|
REACT_APP_OPENID_PROVIDER_URL=EXT_OPENID_PROVIDER_URL
|
||||||
REACT_APP_INTEGRATOR_URL=http://scipaper.ru
|
REACT_APP_INTEGRATOR_URL=EXT_INTEGRATOR_URL
|
||||||
REACT_APP_INTEGRATOR_API_VERSION=/v1
|
REACT_APP_INTEGRATOR_API_VERSION=EXT_INTEGRATOR_API_VERSION
|
||||||
REACT_APP_GRAPHQL_URL=/graphql
|
REACT_APP_GRAPHQL_URL=EXT_GRAPHQL_URL
|
||||||
|
0
.gitignore
vendored
Executable file → Normal file
0
.storybook/index.css
Executable file → Normal file
0
.storybook/main.js
Executable file → Normal file
0
.storybook/main.ts
Executable file → Normal file
0
.storybook/preview.js
Executable file → Normal file
0
.storybook/preview.ts
Executable file → Normal file
25
Dockerfile
Executable file → Normal file
@ -17,25 +17,22 @@ COPY . .
|
|||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Bundle static assets with nginx
|
# Bundle static assets with nginx
|
||||||
FROM node:16-alpine as production
|
FROM nginx:1.21.6 as production
|
||||||
# Copy built assets from builder
|
# Copy built assets from builder
|
||||||
WORKDIR /app
|
COPY --from=builder /app/build /usr/share/nginx/html
|
||||||
COPY --from=builder /app/build .
|
# Add nginx.config
|
||||||
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
# Expose ports
|
# Expose ports
|
||||||
EXPOSE 3000
|
EXPOSE 80
|
||||||
|
|
||||||
|
COPY entrypoint.sh .
|
||||||
COPY .env.production .
|
COPY .env.production .
|
||||||
|
|
||||||
ENV NODE_ENV production
|
ENV NODE_ENV production
|
||||||
ENV USER_NAME=node_user USER_UID=2000 GROUP_NAME=node_group GROUP_UID=2000
|
|
||||||
|
|
||||||
RUN npm i -g serve \
|
# Execute script
|
||||||
&& deluser --remove-home node \
|
RUN ["chmod", "+x", "./entrypoint.sh"]
|
||||||
&& addgroup --g ${GROUP_UID} -S ${GROUP_NAME} \
|
ENTRYPOINT ["./entrypoint.sh"]
|
||||||
&& adduser -D -S -s /sbin/nologin -u ${USER_UID} -G ${GROUP_NAME} ${USER_NAME}\
|
|
||||||
&& chown -R ${USER_NAME}:${GROUP_NAME} "/app/"
|
|
||||||
|
|
||||||
|
# Start serving
|
||||||
USER "${USER_NAME}"
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
CMD serve -s .
|
|
2
Makefile
Executable file → Normal file
@ -1,4 +1,4 @@
|
|||||||
PROJECT_NAME=scipaper-frontend
|
PROJECT_NAME=freeland-frontend
|
||||||
|
|
||||||
setup:
|
setup:
|
||||||
npm i
|
npm i
|
||||||
|
0
global.d.ts
vendored
Executable file → Normal file
0
nginx.conf
Executable file → Normal file
6561
package-lock.json
generated
17
package.json
Executable file → Normal file
@ -3,17 +3,11 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fortawesome/fontawesome-svg-core": "^6.2.0",
|
|
||||||
"@fortawesome/free-brands-svg-icons": "^6.2.0",
|
|
||||||
"@fortawesome/free-solid-svg-icons": "^6.2.0",
|
|
||||||
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
||||||
"@headlessui/react": "^1.6.6",
|
"@headlessui/react": "^1.6.6",
|
||||||
"@reduxjs/toolkit": "^1.8.3",
|
"@reduxjs/toolkit": "^1.8.3",
|
||||||
"@types/node": "^16.11.47",
|
"@types/node": "^16.11.47",
|
||||||
"@types/react": "^18.0.15",
|
"@types/react": "^18.0.15",
|
||||||
"@types/react-copy-to-clipboard": "^5.0.4",
|
|
||||||
"@types/react-dom": "^18.0.6",
|
"@types/react-dom": "^18.0.6",
|
||||||
"@uiw/react-md-editor": "^3.18.1",
|
|
||||||
"axios": "^0.27.2",
|
"axios": "^0.27.2",
|
||||||
"classnames": "^2.3.1",
|
"classnames": "^2.3.1",
|
||||||
"formik": "^2.2.9",
|
"formik": "^2.2.9",
|
||||||
@ -25,22 +19,14 @@
|
|||||||
"jwt-decode": "^3.1.2",
|
"jwt-decode": "^3.1.2",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-copy-to-clipboard": "^5.1.0",
|
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-hotkeys": "^2.0.0",
|
"react-hotkeys": "^2.0.0",
|
||||||
"react-i18next": "^11.18.3",
|
"react-i18next": "^11.18.3",
|
||||||
"react-loading-skeleton": "^3.1.0",
|
|
||||||
"react-lottie": "^1.2.3",
|
|
||||||
"react-markdown": "^8.0.3",
|
|
||||||
"react-redux": "^8.0.2",
|
"react-redux": "^8.0.2",
|
||||||
"react-router-dom": "^6.3.0",
|
"react-router-dom": "^6.3.0",
|
||||||
"react-scripts": "5.0.1",
|
"react-scripts": "5.0.1",
|
||||||
"react-scrollbars-custom": "^4.1.0",
|
"react-scrollbars-custom": "^4.1.0",
|
||||||
"react-syntax-highlighter": "^15.5.0",
|
|
||||||
"remark-code-blocks": "^2.0.1",
|
|
||||||
"remark-gfm": "^3.0.1",
|
|
||||||
"storybook-addon-pseudo-states": "^1.15.1",
|
"storybook-addon-pseudo-states": "^1.15.1",
|
||||||
"swiper": "^8.3.2",
|
|
||||||
"tailwindcss": "^3.1.7",
|
"tailwindcss": "^3.1.7",
|
||||||
"tsconfig-paths-webpack-plugin": "^4.0.0",
|
"tsconfig-paths-webpack-plugin": "^4.0.0",
|
||||||
"typescript": "^4.7.4",
|
"typescript": "^4.7.4",
|
||||||
@ -110,15 +96,12 @@
|
|||||||
"@testing-library/react": "^13.3.0",
|
"@testing-library/react": "^13.3.0",
|
||||||
"@testing-library/user-event": "^13.5.0",
|
"@testing-library/user-event": "^13.5.0",
|
||||||
"@types/jest": "^27.5.2",
|
"@types/jest": "^27.5.2",
|
||||||
"@types/react-lottie": "^1.2.6",
|
|
||||||
"@types/react-syntax-highlighter": "^15.5.5",
|
|
||||||
"autoprefixer": "^10.4.8",
|
"autoprefixer": "^10.4.8",
|
||||||
"babel-plugin-named-exports-order": "^0.0.2",
|
"babel-plugin-named-exports-order": "^0.0.2",
|
||||||
"jest": "^28.1.3",
|
"jest": "^28.1.3",
|
||||||
"postcss": "^8.4.14",
|
"postcss": "^8.4.14",
|
||||||
"prop-types": "^15.8.1",
|
"prop-types": "^15.8.1",
|
||||||
"react-test-renderer": "^18.2.0",
|
"react-test-renderer": "^18.2.0",
|
||||||
"tailwind-scrollbar": "^2.0.1",
|
|
||||||
"webpack": "^5.74.0"
|
"webpack": "^5.74.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
0
postcss.config.js
Executable file → Normal file
0
public/favicon.svg
Executable file → Normal file
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
2
public/index.html
Executable file → Normal file
@ -24,7 +24,7 @@
|
|||||||
work correctly both with client-side routing and a non-root public URL.
|
work correctly both with client-side routing and a non-root public URL.
|
||||||
Learn how to configure a non-root public URL by running `npm run build`.
|
Learn how to configure a non-root public URL by running `npm run build`.
|
||||||
-->
|
-->
|
||||||
<title>Scipaper</title>
|
<title>Freeland</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
|
121
public/locales/en/translation.json
Executable file → Normal file
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"serv": {
|
"serv": {
|
||||||
"goHome": "Home page",
|
"goHome": "Home",
|
||||||
"noSuchPath": "We don't have such a page"
|
"noSuchPath": "We don't have this page"
|
||||||
},
|
},
|
||||||
"sidemenu": {
|
"sidemenu": {
|
||||||
"dashboard": "Dashboard",
|
"dashboard": "Dashboard",
|
||||||
@ -19,130 +19,45 @@
|
|||||||
"hellousr": "Hello, {{username}}",
|
"hellousr": "Hello, {{username}}",
|
||||||
"edit": "Edit",
|
"edit": "Edit",
|
||||||
"language": "Language",
|
"language": "Language",
|
||||||
"selectLanguage": "Select a language",
|
"selectLanguage": "Select language",
|
||||||
"save": "Save",
|
"save": "Save",
|
||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
"account": {
|
"account": {
|
||||||
"info": "Personal Information",
|
"info": "Personal information",
|
||||||
"mail": "Mail",
|
"mail": "Mail",
|
||||||
"connect": "Add Account",
|
"connect": "Add account",
|
||||||
"connectedAccounts_one": "Linked Account",
|
"connectedAccounts_one": "Connected account",
|
||||||
"connectedAccounts_other": "Linked Accounts",
|
"connectedAccounts_other": "Connected accounts",
|
||||||
"settings": "Account Settings"
|
"settings": "Account settings"
|
||||||
},
|
},
|
||||||
"security": {
|
"security": {
|
||||||
"password": {
|
"password": {
|
||||||
"caption": "Password",
|
"caption": "Password",
|
||||||
"twoFactor": "Two-factor authentication (2FA)",
|
"twoFactor": "Two factor authentication (2FA)",
|
||||||
"description": "Protect your account by enabling 2FA via SMS or using a temporary one-time password (OTP) from the authentication app."
|
"description": "Keep your account secure by enabling 2FA via SMS or using a temporary one-time passcode (TOTP) from an authenticator app."
|
||||||
},
|
},
|
||||||
"activity": {
|
"activity": {
|
||||||
"caption": "Device activity"
|
"caption": "Device activity"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"search": {
|
"search": {
|
||||||
"label": "We will find something.."
|
"label": "Search for something.."
|
||||||
},
|
},
|
||||||
"subscriptions": {
|
"subscriptions": {
|
||||||
"subscribed": "The service is attached to the account"
|
"subscribed": "Service have been connected"
|
||||||
},
|
},
|
||||||
"viewHistory": "View history",
|
"viewHistory": "View history",
|
||||||
"logOutEverywhere": "Log out from all devices",
|
"logOutEverywhere": "log out from all devices",
|
||||||
"back": "Back",
|
"back": "Back",
|
||||||
"logOut": "Exit",
|
"logOut": "Log out",
|
||||||
"failures": {
|
"failures": {
|
||||||
"subscriptions": {
|
"subscriptions": {
|
||||||
"failure": "Failed to attach the service to your account",
|
"failure": "Failed to connect service",
|
||||||
"exists": "The service was already attached to your account earlier",
|
"exists": "Service have already been connected",
|
||||||
"confirmation": "Invalid password"
|
"confirmation": "Invalid confirmation information provided"
|
||||||
},
|
},
|
||||||
"services": {
|
"services": {
|
||||||
"fork": "Failed to perform authorization in the service"
|
"fork": "Failed to authenticate in service"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"articlePage": {
|
|
||||||
"abstract": "Abstract",
|
|
||||||
"keywords": "Keywords",
|
|
||||||
"interactionButtons":{
|
|
||||||
"abstract": "Abstract",
|
|
||||||
"readFile": "Read File",
|
|
||||||
"download" : "Download",
|
|
||||||
"share" : "Share",
|
|
||||||
"cite" : "Cite",
|
|
||||||
"copied": "Copied"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
|
||||||
"navbar": {
|
|
||||||
"createNew": "Create New",
|
|
||||||
"about": {
|
|
||||||
"navTitle": "About",
|
|
||||||
"aboutProject": "About Scipaper",
|
|
||||||
"contacts": "Contacts",
|
|
||||||
"help": "Help"
|
|
||||||
},
|
|
||||||
"library": {
|
|
||||||
"navTitle": "My library",
|
|
||||||
"publications": "Publications",
|
|
||||||
"favorites": "Favorites",
|
|
||||||
"collections": "Collections",
|
|
||||||
"recentViewed": "History"
|
|
||||||
},
|
|
||||||
"auth": {
|
|
||||||
"signIn": "Sign In",
|
|
||||||
"signUp": "Sign Up"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"footer": {
|
|
||||||
"accountSettings": "Account Settings",
|
|
||||||
"about": "About Scipaper",
|
|
||||||
"help": "Help",
|
|
||||||
"contactUs": "Contacts",
|
|
||||||
"allRightsReserved": "All rights reserved",
|
|
||||||
"termsOfUse": "Terms of Use",
|
|
||||||
"privacyPolicy": "Privacy Policy",
|
|
||||||
"coockiesPolicy": "coockies Usage Policy",
|
|
||||||
"supportedBy": "Created"
|
|
||||||
},
|
|
||||||
"mainPage": {
|
|
||||||
"title": "Scientific Library with Free Access",
|
|
||||||
"search": "Search",
|
|
||||||
"article_one": "Articles",
|
|
||||||
"article_few": "Articles",
|
|
||||||
"article_many": "Articles",
|
|
||||||
"advancedSearch": "Advanced search",
|
|
||||||
"featuredArticles": {
|
|
||||||
"title": "Featured articles",
|
|
||||||
"descriptionPart1": "Select the category of science you are interested in",
|
|
||||||
"descriptionPart2": "Scientific category",
|
|
||||||
"categories": {
|
|
||||||
"Medical": "Medical",
|
|
||||||
"TechnicsAndTechlonogies": "Technics and Technology",
|
|
||||||
"Fundamental": "Fundamental",
|
|
||||||
"Humanitarian": "Humanitarian",
|
|
||||||
"Agricultural": "Agricultural",
|
|
||||||
"Social": "Social"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"featuredAuthors": "Featured authors",
|
|
||||||
"more": "See More ",
|
|
||||||
"showAll": "Show all"
|
|
||||||
},
|
|
||||||
"searchResults": {
|
|
||||||
"title": "Search results",
|
|
||||||
"totalResults":"Total results",
|
|
||||||
"nothingFound": "Nothing found"
|
|
||||||
},
|
|
||||||
"filters": {
|
|
||||||
"authors":"Authors",
|
|
||||||
"publicationsType": "Publications Type",
|
|
||||||
"content":"Content",
|
|
||||||
"publisher":"Publisher",
|
|
||||||
"publicationTopic":"Publication Topic",
|
|
||||||
"appliedFitlers":"Applied Fitlers",
|
|
||||||
"clearAll":"Clear All",
|
|
||||||
"enterAuthorsName":"Enter Author Name",
|
|
||||||
"showAll":"Show All"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
82
public/locales/ru/translation.json
Executable file → Normal file
@ -59,87 +59,5 @@
|
|||||||
"services": {
|
"services": {
|
||||||
"fork": "Не удалось выполнить авторизацию в сервисе"
|
"fork": "Не удалось выполнить авторизацию в сервисе"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"articlePage": {
|
|
||||||
"abstract": "Введение",
|
|
||||||
"keywords": "Ключевые слова",
|
|
||||||
"interactionButtons":{
|
|
||||||
"abstract": "Развернуть",
|
|
||||||
"readFile": "Читать",
|
|
||||||
"download" : "Скачать",
|
|
||||||
"share" : "Поделиться",
|
|
||||||
"cite" : "Цитировать",
|
|
||||||
"copied": "Скопировано"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"navbar": {
|
|
||||||
"createNew": "Создать статью",
|
|
||||||
"about": {
|
|
||||||
"navTitle": "О проекте",
|
|
||||||
"aboutProject": "О Scipaper",
|
|
||||||
"contacts": "Контакты",
|
|
||||||
"help": "Помощь"
|
|
||||||
},
|
|
||||||
"library": {
|
|
||||||
"navTitle": "Моя библиотека",
|
|
||||||
"publications": "Публикации",
|
|
||||||
"favorites": "Избранное",
|
|
||||||
"collections": "Коллекции",
|
|
||||||
"recentViewed": "История"
|
|
||||||
},
|
|
||||||
"auth": {
|
|
||||||
"signIn": "Вход",
|
|
||||||
"signUp": "Регистрация"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"footer": {
|
|
||||||
"accountSettings": "Настройки аккаунта",
|
|
||||||
"about": "О scipaper",
|
|
||||||
"help": "Помощь",
|
|
||||||
"contactUs": "Контакты",
|
|
||||||
"allRightsReserved": "Все права защищены",
|
|
||||||
"termsOfUse": "Правила использования",
|
|
||||||
"privacyPolicy": "Политика конфиденциальности",
|
|
||||||
"coockiesPolicy": "Политика использования coockies",
|
|
||||||
"supportedBy": "Создано"
|
|
||||||
},
|
|
||||||
"mainPage": {
|
|
||||||
"title": "Библиотека научных статей с бесплатным доступом",
|
|
||||||
"search": "Поиск",
|
|
||||||
"article_one": "статьи",
|
|
||||||
"article_few": "статей",
|
|
||||||
"article_many": "статей",
|
|
||||||
"advancedSearch": "Расширенный поиск",
|
|
||||||
"featuredArticles": {
|
|
||||||
"title": "Популярные статьи",
|
|
||||||
"descriptionPart1": "Выберете интересующую вас ",
|
|
||||||
"descriptionPart2": "научную категорию",
|
|
||||||
"categories": {
|
|
||||||
"Medical": "Медицина",
|
|
||||||
"TechnicsAndTechlonogies": "Техника и технологии",
|
|
||||||
"Fundamental": "Естественые",
|
|
||||||
"Humanitarian": "Гуманитарные",
|
|
||||||
"Agricultural": "Аuрокультурa",
|
|
||||||
"Social": "Социальные"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"featuredAuthors": "Популярные авторы",
|
|
||||||
"more": "Больше",
|
|
||||||
"showAll": "Показать все"
|
|
||||||
},
|
|
||||||
"searchResults": {
|
|
||||||
"title": "Результаты поиска",
|
|
||||||
"totalResults":"Всего найдено",
|
|
||||||
"nothingFound": "Ничего не найдено"
|
|
||||||
},
|
|
||||||
"filters": {
|
|
||||||
"authors":"Авторы",
|
|
||||||
"publicationsType": "Публикации",
|
|
||||||
"publisher":"Издатель",
|
|
||||||
"publicationTopic":"Тема публикации",
|
|
||||||
"appliedFitlers":"Фильтры",
|
|
||||||
"clearAll":"Очистить всё",
|
|
||||||
"enterAuthorsName":"Введите имя автора",
|
|
||||||
"showAll":"Показать все"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
0
public/logo192.png
Executable file → Normal file
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
0
public/logo512.png
Executable file → Normal file
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
0
public/manifest.json
Executable file → Normal file
0
public/robots.txt
Executable file → Normal file
0
src/.storybook/main.js
Executable file → Normal file
0
src/.storybook/preview.js
Executable file → Normal file
0
src/App.css
Executable file → Normal file
0
src/App.test.tsx
Executable file → Normal file
4
src/App.tsx
Executable file → Normal file
@ -2,8 +2,6 @@
|
|||||||
/* Libraries */
|
/* Libraries */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import MainPage from "pages/MainPage";
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* Application root component */
|
/* Application root component */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
@ -12,7 +10,7 @@ import MainPage from "pages/MainPage";
|
|||||||
* @return {JSX.Element}
|
* @return {JSX.Element}
|
||||||
*/
|
*/
|
||||||
function App() {
|
function App() {
|
||||||
return <MainPage />;
|
return <div>Hello world!</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default App;
|
export default App;
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
import type { ArticleStore } from "../domain/articleStore";
|
|
||||||
import { getArticleUseCase } from "../useCases/getArticleUseCase";
|
|
||||||
import { useCallback, useEffect } from "react";
|
|
||||||
|
|
||||||
function useArticleViewModel(store: ArticleStore) {
|
|
||||||
const _getArticle = useCallback(
|
|
||||||
(id: string) => getArticleUseCase(store.getArticle, store.setArticle, id),
|
|
||||||
[store.getArticle, store.setArticle]
|
|
||||||
);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (store.article != undefined) {
|
|
||||||
_getArticle(store.article.id);
|
|
||||||
}
|
|
||||||
}, [store.article?.id]);
|
|
||||||
|
|
||||||
return {
|
|
||||||
article: store.article,
|
|
||||||
shouldShowLoading: typeof store.article === "undefined" || store.isLoading,
|
|
||||||
hasError: store.hasError,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export { useArticleViewModel };
|
|
@ -1,36 +0,0 @@
|
|||||||
import axios from "axios";
|
|
||||||
import { Article } from "../domain/articleEntity";
|
|
||||||
import { create } from "../domain/articleModel";
|
|
||||||
import { FetchArticleByIdDTO } from "./dto/fetch_article_by_id_dto";
|
|
||||||
import Failure from "core/failure";
|
|
||||||
import { integratorApiClient } from "core/httpClient";
|
|
||||||
|
|
||||||
const articleEndpoint = "/papers/"
|
|
||||||
|
|
||||||
async function getArticle(id: string): Promise<Article> {
|
|
||||||
try {
|
|
||||||
const response = await integratorApiClient.get<FetchArticleByIdDTO>(
|
|
||||||
// `https://run.mocky.io/v3/62cd4581-d864-4d46-b1d6-02b45b5d1994/${id}`
|
|
||||||
// `https://jsonplaceholder.typicode.com/posts/${id}`
|
|
||||||
// `https://run.mocky.io/v3/066be3d8-0568-439a-8b20-062deed49a97`
|
|
||||||
articleEndpoint + id
|
|
||||||
);
|
|
||||||
const dto = response.data;
|
|
||||||
return create({
|
|
||||||
id: dto.id,
|
|
||||||
topic: [dto.topic],
|
|
||||||
title: dto.title,
|
|
||||||
authors: dto.authors,
|
|
||||||
tags: dto.tags,
|
|
||||||
summary: dto.summary,
|
|
||||||
content: dto.content,
|
|
||||||
});
|
|
||||||
} catch (reason) {
|
|
||||||
if (axios.isAxiosError(reason)) {
|
|
||||||
throw Failure.fromReason(reason, "failures.services.load");
|
|
||||||
}
|
|
||||||
throw reason;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { getArticle };
|
|
@ -1,4 +0,0 @@
|
|||||||
export const SET_ARTICLE = "SET_ARTICLE";
|
|
||||||
export const GET_ARTICLE = "GET_ARTICLE";
|
|
||||||
export const GET_ARTICLE_SUCCESS = "GET_ARTICLE.success";
|
|
||||||
export const GET_ARTICLE_FAILURE = "GET_ARTICLE.failure";
|
|
@ -1,23 +0,0 @@
|
|||||||
import type { Article } from "../domain/articleEntity";
|
|
||||||
import { getArticle as getArticleAPI } from "./articleAPIService";
|
|
||||||
import * as actionTypes from "./articleActionTypes";
|
|
||||||
import { dispatchStatus } from "../../store/index";
|
|
||||||
|
|
||||||
const setArticleAction = (article: Article) => (dispatch: any) =>
|
|
||||||
dispatch({ type: actionTypes.SET_ARTICLE, article });
|
|
||||||
|
|
||||||
const getArticleAction = (id: string) => (dispatch: any) => {
|
|
||||||
dispatch({ type: actionTypes.GET_ARTICLE });
|
|
||||||
|
|
||||||
return getArticleAPI(id)
|
|
||||||
.then((article) => {
|
|
||||||
dispatchStatus(actionTypes.GET_ARTICLE, ".success", article)(dispatch);
|
|
||||||
return article;
|
|
||||||
})
|
|
||||||
.catch((reason) => {
|
|
||||||
dispatchStatus(actionTypes.GET_ARTICLE, ".failure", reason)(dispatch);
|
|
||||||
return reason;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export { setArticleAction, getArticleAction };
|
|
@ -1,39 +0,0 @@
|
|||||||
import React, { useCallback, useState } from "react";
|
|
||||||
import { useDispatch } from "react-redux";
|
|
||||||
import { ArticleStore } from "../domain/articleStore";
|
|
||||||
import type { Article } from "../domain/articleEntity";
|
|
||||||
import { getArticle as getArticleAPI } from "./articleAPIService";
|
|
||||||
|
|
||||||
const useArticleCommonStore = (): ArticleStore => {
|
|
||||||
const [isLoading, setLoading] = useState<boolean>(false);
|
|
||||||
const [hasError, setError] = useState<boolean>(false);
|
|
||||||
const [article, setArticleState] = useState<Article | undefined>();
|
|
||||||
|
|
||||||
const dispatch = useDispatch();
|
|
||||||
|
|
||||||
const getArticle = useCallback(
|
|
||||||
async (id: string) => {
|
|
||||||
setLoading(true);
|
|
||||||
try {
|
|
||||||
const article = await getArticleAPI(id);
|
|
||||||
setArticleState(article);
|
|
||||||
setLoading(false);
|
|
||||||
return article;
|
|
||||||
} catch (error) {
|
|
||||||
setError(true);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[dispatch]
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
|
||||||
article: article,
|
|
||||||
isLoading,
|
|
||||||
hasError,
|
|
||||||
setArticle: setArticleState,
|
|
||||||
getArticle,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export { useArticleCommonStore };
|
|
@ -1,32 +0,0 @@
|
|||||||
import { AnyAction } from "@reduxjs/toolkit";
|
|
||||||
import type { ArticleStore } from "../domain/articleStore";
|
|
||||||
import * as actionTypes from "./articleActionTypes";
|
|
||||||
|
|
||||||
type ArticleStoreState = Omit<ArticleStore, "getArticle" | "setArticle">;
|
|
||||||
|
|
||||||
const INITIAL_STATE: ArticleStoreState = {
|
|
||||||
article: undefined,
|
|
||||||
isLoading: false,
|
|
||||||
hasError: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
const articleReducer = (
|
|
||||||
state: ArticleStoreState = INITIAL_STATE,
|
|
||||||
action: AnyAction
|
|
||||||
): ArticleStoreState => {
|
|
||||||
switch (action.type) {
|
|
||||||
case actionTypes.SET_ARTICLE:
|
|
||||||
return { ...state, article: action.article };
|
|
||||||
case actionTypes.GET_ARTICLE:
|
|
||||||
return { ...state, isLoading: true };
|
|
||||||
case actionTypes.GET_ARTICLE_SUCCESS:
|
|
||||||
return { ...state, isLoading: false, article: action.payload };
|
|
||||||
case actionTypes.GET_ARTICLE_FAILURE:
|
|
||||||
return { ...state, hasError: true, isLoading: false };
|
|
||||||
default:
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export { articleReducer };
|
|
||||||
export type { ArticleStoreState };
|
|
@ -1,35 +0,0 @@
|
|||||||
import React, { useCallback, useState } from "react";
|
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
|
||||||
import { ArticleStore } from "../domain/articleStore";
|
|
||||||
import type { Article } from "../domain/articleEntity";
|
|
||||||
import type { ArticleStoreState } from "../data/articleReducer";
|
|
||||||
import { getArticleAction, setArticleAction } from "./articleActions";
|
|
||||||
import { RootState, useAppSelector } from "store";
|
|
||||||
|
|
||||||
const articleSelector = (state: RootState): ArticleStoreState => state.article;
|
|
||||||
|
|
||||||
const useArticleStore = (): ArticleStore => {
|
|
||||||
const { isLoading, article, hasError } = useAppSelector(articleSelector);
|
|
||||||
|
|
||||||
const dispatch = useDispatch();
|
|
||||||
|
|
||||||
const setArticle = useCallback(
|
|
||||||
(article: Article) => setArticleAction(article)(dispatch),
|
|
||||||
[dispatch]
|
|
||||||
);
|
|
||||||
|
|
||||||
const getArticle = useCallback(
|
|
||||||
(id: string) => getArticleAction(id)(dispatch),
|
|
||||||
[dispatch]
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
|
||||||
article: article,
|
|
||||||
isLoading,
|
|
||||||
hasError,
|
|
||||||
setArticle,
|
|
||||||
getArticle,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export { useArticleStore };
|
|
@ -1,9 +0,0 @@
|
|||||||
export interface FetchArticleByIdDTO {
|
|
||||||
id: string;
|
|
||||||
topic: string;
|
|
||||||
title: string;
|
|
||||||
authors: string[];
|
|
||||||
tags: string[];
|
|
||||||
summary: string;
|
|
||||||
content: string;
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
export interface Article {
|
|
||||||
id: string;
|
|
||||||
title: string;
|
|
||||||
content: string;
|
|
||||||
topic?: string[];
|
|
||||||
authors?: string[];
|
|
||||||
tags?: string[];
|
|
||||||
summary?: string;
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
import { CreateArticleParams } from "article/useCases/params/create_article_params";
|
|
||||||
import { Article } from "./articleEntity";
|
|
||||||
|
|
||||||
const create = (props: CreateArticleParams): Article => ({
|
|
||||||
id: props.id,
|
|
||||||
topic: props.topic,
|
|
||||||
title: props.title,
|
|
||||||
authors: props.authors,
|
|
||||||
tags: props.tags,
|
|
||||||
summary: props.summary,
|
|
||||||
content: props.content,
|
|
||||||
});
|
|
||||||
|
|
||||||
export { create };
|
|
@ -1,13 +0,0 @@
|
|||||||
import { Article } from './articleEntity';
|
|
||||||
interface ArticleStore {
|
|
||||||
// State
|
|
||||||
article: Article | undefined;
|
|
||||||
isLoading: boolean;
|
|
||||||
hasError: boolean;
|
|
||||||
|
|
||||||
// Actions
|
|
||||||
setArticle(article?: Article): void;
|
|
||||||
getArticle(identifier: string): Promise<Article | null>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type { ArticleStore };
|
|
@ -1,16 +0,0 @@
|
|||||||
import { Article } from "article/domain/articleEntity";
|
|
||||||
import type { ArticleStore } from "../domain/articleStore";
|
|
||||||
|
|
||||||
const getArticleUseCase = async (
|
|
||||||
getArticle: ArticleStore["getArticle"],
|
|
||||||
setArticle: ArticleStore["setArticle"],
|
|
||||||
id: Article["id"]
|
|
||||||
): Promise<Article | null> => {
|
|
||||||
const article = await getArticle(id);
|
|
||||||
if (article) {
|
|
||||||
await setArticle(article);
|
|
||||||
}
|
|
||||||
return article;
|
|
||||||
};
|
|
||||||
|
|
||||||
export { getArticleUseCase };
|
|
@ -1,9 +0,0 @@
|
|||||||
export interface CreateArticleParams {
|
|
||||||
id: string;
|
|
||||||
topic: string[];
|
|
||||||
title: string;
|
|
||||||
authors: string[];
|
|
||||||
tags: string[];
|
|
||||||
summary: string;
|
|
||||||
content: string;
|
|
||||||
}
|
|
0
src/assets/fonts/Inter-Black.ttf
Executable file → Normal file
0
src/assets/fonts/Inter-Bold.ttf
Executable file → Normal file
0
src/assets/fonts/Inter-ExtraBold.ttf
Executable file → Normal file
0
src/assets/fonts/Inter-ExtraLight.ttf
Executable file → Normal file
0
src/assets/fonts/Inter-Light.ttf
Executable file → Normal file
0
src/assets/fonts/Inter-Medium.ttf
Executable file → Normal file
0
src/assets/fonts/Inter-Regular.ttf
Executable file → Normal file
0
src/assets/fonts/Inter-SemiBold.ttf
Executable file → Normal file
0
src/assets/fonts/Inter-Thin.ttf
Executable file → Normal file
0
src/assets/fonts/Poppins-Bold.eot
Executable file → Normal file
0
src/assets/fonts/Poppins-Bold.ttf
Executable file → Normal file
0
src/assets/fonts/Poppins-Bold.woff2
Executable file → Normal file
0
src/assets/fonts/Poppins-Medium.eot
Executable file → Normal file
0
src/assets/fonts/Poppins-Medium.ttf
Executable file → Normal file
0
src/assets/fonts/Poppins-Medium.woff2
Executable file → Normal file
0
src/assets/fonts/Poppins-Regular.eot
Executable file → Normal file
0
src/assets/fonts/Poppins-Regular.ttf
Executable file → Normal file
0
src/assets/fonts/Poppins-Regular.woff2
Executable file → Normal file
0
src/assets/fonts/Poppins-Thin.eot
Executable file → Normal file
0
src/assets/fonts/Poppins-Thin.ttf
Executable file → Normal file
0
src/assets/fonts/Poppins-Thin.woff2
Executable file → Normal file
0
src/assets/svg/agricultural.svg
Executable file → Normal file
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
0
src/assets/svg/arrow-big-right.svg
Executable file → Normal file
Before Width: | Height: | Size: 513 B After Width: | Height: | Size: 510 B |
0
src/assets/svg/arrow-down.svg
Executable file → Normal file
Before Width: | Height: | Size: 345 B After Width: | Height: | Size: 341 B |
0
src/assets/svg/arrow-left.svg
Executable file → Normal file
Before Width: | Height: | Size: 345 B After Width: | Height: | Size: 341 B |
0
src/assets/svg/arrow-right.svg
Executable file → Normal file
Before Width: | Height: | Size: 311 B After Width: | Height: | Size: 307 B |
0
src/assets/svg/arrow-up.svg
Executable file → Normal file
Before Width: | Height: | Size: 315 B After Width: | Height: | Size: 311 B |
0
src/assets/svg/background.svg
Executable file → Normal file
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
0
src/assets/svg/bell-notification.svg
Executable file → Normal file
Before Width: | Height: | Size: 735 B After Width: | Height: | Size: 730 B |
0
src/assets/svg/bell.svg
Executable file → Normal file
Before Width: | Height: | Size: 637 B After Width: | Height: | Size: 633 B |
0
src/assets/svg/bookmark-filled.svg
Executable file → Normal file
Before Width: | Height: | Size: 347 B After Width: | Height: | Size: 344 B |
0
src/assets/svg/bookmark-outlined.svg
Executable file → Normal file
Before Width: | Height: | Size: 359 B After Width: | Height: | Size: 356 B |
0
src/assets/svg/caret-down.svg
Executable file → Normal file
Before Width: | Height: | Size: 306 B After Width: | Height: | Size: 303 B |
0
src/assets/svg/caret-left.svg
Executable file → Normal file
Before Width: | Height: | Size: 318 B After Width: | Height: | Size: 315 B |
0
src/assets/svg/caret-right.svg
Executable file → Normal file
Before Width: | Height: | Size: 317 B After Width: | Height: | Size: 314 B |
0
src/assets/svg/caret-up.svg
Executable file → Normal file
Before Width: | Height: | Size: 312 B After Width: | Height: | Size: 309 B |
0
src/assets/svg/chart.svg
Executable file → Normal file
Before Width: | Height: | Size: 345 B After Width: | Height: | Size: 339 B |
0
src/assets/svg/chevrones-left.svg
Executable file → Normal file
Before Width: | Height: | Size: 645 B After Width: | Height: | Size: 639 B |
0
src/assets/svg/chevrones-right.svg
Executable file → Normal file
Before Width: | Height: | Size: 594 B After Width: | Height: | Size: 588 B |
0
src/assets/svg/circle.svg
Executable file → Normal file
Before Width: | Height: | Size: 148 B After Width: | Height: | Size: 145 B |
0
src/assets/svg/cite.svg
Executable file → Normal file
Before Width: | Height: | Size: 915 B After Width: | Height: | Size: 906 B |
0
src/assets/svg/copy.svg
Executable file → Normal file
Before Width: | Height: | Size: 430 B After Width: | Height: | Size: 426 B |
0
src/assets/svg/delete.svg
Executable file → Normal file
Before Width: | Height: | Size: 542 B After Width: | Height: | Size: 537 B |
0
src/assets/svg/download.svg
Executable file → Normal file
Before Width: | Height: | Size: 490 B After Width: | Height: | Size: 485 B |
0
src/assets/svg/duplicate.svg
Executable file → Normal file
Before Width: | Height: | Size: 645 B After Width: | Height: | Size: 639 B |
0
src/assets/svg/edit1.svg
Executable file → Normal file
Before Width: | Height: | Size: 578 B After Width: | Height: | Size: 575 B |
0
src/assets/svg/edit2.svg
Executable file → Normal file
Before Width: | Height: | Size: 725 B After Width: | Height: | Size: 721 B |
0
src/assets/svg/error.svg
Executable file → Normal file
Before Width: | Height: | Size: 485 B After Width: | Height: | Size: 480 B |
0
src/assets/svg/eye.svg
Executable file → Normal file
Before Width: | Height: | Size: 445 B After Width: | Height: | Size: 441 B |
0
src/assets/svg/facebook.svg
Executable file → Normal file
Before Width: | Height: | Size: 651 B After Width: | Height: | Size: 648 B |
0
src/assets/svg/favorite-filled.svg
Executable file → Normal file
Before Width: | Height: | Size: 259 B After Width: | Height: | Size: 256 B |
0
src/assets/svg/favorite-outlined.svg
Executable file → Normal file
Before Width: | Height: | Size: 285 B After Width: | Height: | Size: 282 B |
0
src/assets/svg/file.svg
Executable file → Normal file
Before Width: | Height: | Size: 491 B After Width: | Height: | Size: 486 B |
0
src/assets/svg/filetext.svg
Executable file → Normal file
Before Width: | Height: | Size: 639 B After Width: | Height: | Size: 632 B |