Skip to content

Commit

Permalink
liferay-labs-br#241 Upgrade React and Next Libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
kevenleone committed Aug 7, 2022
1 parent fbc0c37 commit f88ce35
Show file tree
Hide file tree
Showing 26 changed files with 535 additions and 1,329 deletions.
2 changes: 1 addition & 1 deletion packages/backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class App {
try {
const conn = await createTypeormConn();

logger.debug('Database connected success');
logger.debug('Database connected with success');

const migrations = await conn.runMigrations({ transaction: 'all' });

Expand Down
52 changes: 33 additions & 19 deletions packages/eslint-config-node/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
browser: true,
es2020: true,
node: true,
jest: true
jest: true,
},
extends: [
'plugin:react/recommended',
Expand All @@ -12,36 +12,50 @@ module.exports = {
'prettier/@typescript-eslint',
'prettier/standard',
'prettier/react',
'plugin:prettier/recommended'
'plugin:prettier/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true
jsx: true,
},
ecmaVersion: 2020,
sourceType: 'module'
sourceType: 'module',
},
plugins: ['react', '@typescript-eslint', 'prettier', 'simple-import-sort', 'sort-destructure-keys', 'sort-keys-fix'],
plugins: [
'react',
'@typescript-eslint',
'prettier',
'simple-import-sort',
'sort-destructure-keys',
'sort-keys-fix',
],
rules: {
'semi': ["error", "always"],
"simple-import-sort/sort": "error",
"sort-keys": ["error", "asc", { "caseSensitive": true, "natural": false, "minKeys": 2 }],
"sort-destructure-keys/sort-destructure-keys": [2, { "caseSensitive": false }],
"sort-keys-fix/sort-keys-fix": "warn",
"no-explicit-any": "off",
"camelcase": "off",
"react/display-name": "off",
"react/prop-types": "off",
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["error"]
semi: ['error', 'always'],
'simple-import-sort/sort': 'error',
'sort-keys': [
'error',
'asc',
{ caseSensitive: true, natural: false, minKeys: 2 },
],
'sort-destructure-keys/sort-destructure-keys': [
2,
{ caseSensitive: false },
],
'sort-keys-fix/sort-keys-fix': 'warn',
'no-explicit-any': 'off',
camelcase: 'off',
'react/display-name': 'off',
'react/prop-types': 'off',
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['error'],
},
settings: {
'import/resolver': {
typescript: {}
typescript: {},
},
react: {
version: 'detect',
},
}
}
},
};
6 changes: 4 additions & 2 deletions packages/frontend/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next-images" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
78 changes: 78 additions & 0 deletions packages/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
"graphql": "^15.5.0",
"js-cookie": "^2.2.1",
"moment": "^2.29.1",
"next": "10.0.7",
"next": "12.2.4",
"next-images": "^1.7.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-toastify": "^7.0.3",
"recharts": "^2.0.9",
"sass": "^1.32.7"
Expand All @@ -55,9 +55,9 @@
"@testing-library/user-event": "^12.8.3",
"@types/classnames": "^2.2.11",
"@types/js-cookie": "^2.2.6",
"@types/node": "^14.14.28",
"@types/react": "^17.0.2",
"@types/node": "^18.6.4",
"@types/react": "^18.0.16",
"babel-jest": "^26.6.3",
"typescript": "^4.2.4"
"typescript": "^4.7.4"
}
}
3 changes: 2 additions & 1 deletion packages/frontend/src/components/drop-down/DropDownTabs.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ClayDropDown, { Align } from '@clayui/drop-down';
import ClayIcon from '@clayui/icon';
import ClayTabs from '@clayui/tabs';
import React, { useState } from 'react';
import React, { ReactElement, useState } from 'react';

import useLang from '@/hooks/useLang';

Expand All @@ -13,6 +13,7 @@ type Tab = {

type ClayDropDownWithTabsProps = {
tabs: Tab[];
children: ReactElement;
offset: number;
onClick?: (tab: Tab) => void;
};
Expand Down
3 changes: 2 additions & 1 deletion packages/frontend/src/components/empty-state/EmptyState.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import ClayEmptyState from '@clayui/empty-state';
import React from 'react';
import React, { ReactElement } from 'react';

import useLang from '@/hooks/useLang';

export type EmptyStateProps = {
children?: ReactElement;
description?: string;
title?: string;
};
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/panel/Panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import ClayCard from '@clayui/card';
import ClayLayout from '@clayui/layout';
import ClayPanel from '@clayui/panel';
import classNames from 'classnames';
import React from 'react';
import React, { ReactElement } from 'react';

import ProgressBar from './ProgressBar';

type IPanelItem = {
children: ReactElement;
onClick?: () => void;
};

Expand Down Expand Up @@ -44,6 +45,7 @@ const PanelBody: React.FC<React.HTMLAttributes<HTMLElement>> = ({
};

interface IPanelProps {
children: ReactElement;
title: string;
defaultExpanded?: boolean;
displayType?: 'secondary' | 'unstyled';
Expand Down
3 changes: 2 additions & 1 deletion packages/frontend/src/components/profile/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ClayCard from '@clayui/card';
import ClayLayout from '@clayui/layout';
import { useRouter } from 'next/router';
import React, { useContext } from 'react';
import React, { ReactElement, useContext } from 'react';

import AppContext from '@/AppContext';
import Header from '@/components/header';
Expand All @@ -25,6 +25,7 @@ const defaultSteps = [
type Steps = typeof Sidebar.defaultProps.steps;

type IProfileWrapper = {
children: ReactElement;
me: User;
steps?: Steps;
};
Expand Down
5 changes: 3 additions & 2 deletions packages/frontend/src/components/sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ClayIcon from '@clayui/icon';
import classNames from 'classnames';
import { useRouter } from 'next/router';
import React from 'react';
import React, { ReactElement } from 'react';

import useLang from '@/hooks/useLang';

Expand All @@ -13,8 +13,9 @@ type Step = {

type SidebarItemProps = {
active?: boolean;
symbol: string;
children: ReactElement | string;
onClick: () => void;
symbol: string;
};

type SidebarProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useReducer, useState } from 'react';
import React, { ReactElement, useEffect, useReducer, useState } from 'react';

import { initializeApollo } from '@/graphql/nextApollo';
import { allKnowledgeData } from '@/graphql/queries';
Expand All @@ -9,6 +9,7 @@ import SkillContext, { initialState, mainReducer } from './SkillContext';

type SkillContextProvider = {
defaultState?: SkillManagement;
children: ReactElement | ReactElement[];
fetchData?: boolean;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,13 @@ const SkillListWithAverage: React.FC<SkillListWithAverageProps> = ({

return (
<Panel.Item key={index} onClick={() => handleClickSkill(skill)}>
<Panel.Title>{skill.name}</Panel.Title>
<Panel.Body>
<span>{matrizName}</span>
</Panel.Body>
<Panel.ProgressBar partialValue={matrizLevelAvg} />
<>
<Panel.Title>{skill.name}</Panel.Title>
<Panel.Body>
<span>{matrizName}</span>
</Panel.Body>
<Panel.ProgressBar partialValue={matrizLevelAvg} />
</>
</Panel.Item>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type ServerInfo = {
};
};

const AuthTemplate: React.FC = ({ children, className }: AuthProps) => {
const AuthTemplate: React.FC<AuthProps> = ({ children, className }) => {
const i18n = useLang();

const frontendVersion = process.env.NEXT_PUBLIC_PACKAGE_VERSION;
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/src/components/templates/HomeTemplate.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ClayCard from '@clayui/card';
import ClayLayout from '@clayui/layout';
import React from 'react';
import React, { ReactElement } from 'react';

import Sidebar from '@/components/sidebar/Sidebar';

Expand All @@ -17,7 +17,7 @@ const steps = [
},
];

const HomeTemplate: React.FC = ({ children }) => {
const HomeTemplate: React.FC<{ children: ReactElement[] }> = ({ children }) => {
return (
<div className="home">
<ClayLayout.ContainerFluid>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ClayButton from '@clayui/button';
import { useRouter } from 'next/router';
import React, { useContext } from 'react';
import React, { ReactElement, useContext } from 'react';

import Profile, { ProfileWrapper } from '@/components/profile';
import SkillContext from '@/components/skill-management/SkillContext';
Expand Down Expand Up @@ -36,6 +36,7 @@ const userSkillsPaths = [
];

type ITemplateProps = {
children: ReactElement;
me: User;
title: string;
};
Expand Down Expand Up @@ -88,8 +89,10 @@ const UserSkillTemplate: React.FC<ITemplateProps> = ({
<Profile>
<Meta title={i18n.sub('app-title-x', title)} />
<ProfileWrapper steps={userSkillsPaths} me={me}>
<h1 className="mb-4">{title}</h1>
{children}
<>
<h1 className="mb-4">{title}</h1>
{children}
</>
</ProfileWrapper>
</Profile>
);
Expand Down
Loading

0 comments on commit f88ce35

Please sign in to comment.