Skip to content
This repository has been archived by the owner on Mar 23, 2022. It is now read-only.

v2.12.0 Release #232

Merged
merged 29 commits into from
Aug 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b50db04
OTH - Remove config for `pm2` watch
RaenonX Jul 29, 2021
111d1a9
IMP - Changed array form button from text to icon
RaenonX Jul 29, 2021
7c31046
FIX - Azure pipeline cannot upload Cypress failure
RaenonX Jul 29, 2021
e1b7133
IMP - Array form to delete specific item (#226)
RaenonX Jul 30, 2021
339a243
FIX - Failing quest form test
RaenonX Jul 30, 2021
31285c5
FIX - Unload dialog shown upon form publishing (#227)
RaenonX Aug 1, 2021
5f65390
FIX - Color not applied in table header (#229)
RaenonX Aug 2, 2021
d5e2232
ADD - Utils to check failed API response
RaenonX Aug 3, 2021
e08679a
IMP - Array data form typings
RaenonX Aug 3, 2021
5bef5c3
IMP - `overrideObject` to handle null and undefined values
RaenonX Aug 3, 2021
7a34fec
ADD - UI to manage name references (#188)
RaenonX Aug 5, 2021
53e5d07
IMP - `posts` files refactor
RaenonX Aug 5, 2021
66e59ba
IMP - `gameData` files refactor
RaenonX Aug 5, 2021
caf6bc3
FIX - Dependency errors
RaenonX Aug 5, 2021
ebfdfb3
ADD - Utils for getting the element count
RaenonX Aug 5, 2021
6aa615d
IMP - Rename unit name reference EP
RaenonX Aug 5, 2021
031b4de
ADD - Validation for duplicated unit names (#188)
RaenonX Aug 5, 2021
2d5d8b2
ADD - Button bar
RaenonX Aug 5, 2021
3528c99
IMP - Post manage bar to use `<ButtonBar>`
RaenonX Aug 5, 2021
4ceeb70
IMP - Update path name of unit name reference managing page
RaenonX Aug 5, 2021
3ab8850
ADD - Link button to manage unit names in unit info index page (#188)
RaenonX Aug 5, 2021
7349c6f
IMP - Button bar to take `url` -> `pathname`
RaenonX Aug 5, 2021
34d65e5
IMP - Link naming disambiguation
RaenonX Aug 5, 2021
2344884
IMP - Button bar to handle language in `url`
RaenonX Aug 5, 2021
de23373
FIX - Failing post manage bar tests
RaenonX Aug 5, 2021
623d53c
IMP - Refactor app context resources
RaenonX Aug 6, 2021
c078429
FIX - `overrideObject` to handle override on empty object
RaenonX Aug 6, 2021
5c92bd6
IMP - Markdown tests refactor
RaenonX Aug 6, 2021
c273ae6
ADD - Affliction icon besides text (#231)
RaenonX Aug 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .azure/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ stages:
displayName: 'Copy Failure Results'
condition: failed()
inputs:
SourceFolder: '.cypress'
SourceFolder: '$(Pipeline.Workspace)/s/.cypress'
Contents: |
./screenshots/**
./videos/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "dragalia-site-front",
"description": "Frontend of DL info website by OM.",
"repository": "https://github.com/RaenonX-DL/dragalia-site-front",
"version": "2.11.1",
"version": "2.12.0",
"engines": {
"node": "14.x",
"npm": "^7.12.0"
Expand Down
4 changes: 2 additions & 2 deletions pages/[lang]/analysis/[pid].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
DragonAnalysisGetResponse,
UnitType,
} from '../../../src/api-def/api';
import {AnalysisOutputChara} from '../../../src/components/elements/posts/analysis/output/chara';
import {AnalysisOutputDragon} from '../../../src/components/elements/posts/analysis/output/dragon';
import {AnalysisOutputChara} from '../../../src/components/pages/posts/analysis/output/chara';
import {AnalysisOutputDragon} from '../../../src/components/pages/posts/analysis/output/dragon';
import {useI18n} from '../../../src/i18n/hook';
import {ApiRequestSender} from '../../../src/utils/services/api/requestSender';
import {getServerSidePropsPost} from '../../../src/utils/ssr';
Expand Down
4 changes: 2 additions & 2 deletions pages/[lang]/analysis/[pid]/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
DragonAnalysisBody,
UnitType,
} from '../../../../src/api-def/api';
import {AnalysisFormCharaEdit} from '../../../../src/components/elements/posts/analysis/form/chara/edit';
import {AnalysisFormDragonEdit} from '../../../../src/components/elements/posts/analysis/form/dragon/edit';
import {AnalysisFormCharaEdit} from '../../../../src/components/pages/posts/analysis/form/chara/edit';
import {AnalysisFormDragonEdit} from '../../../../src/components/pages/posts/analysis/form/dragon/edit';
import {useI18n} from '../../../../src/i18n/hook';
import {ApiRequestSender} from '../../../../src/utils/services/api/requestSender';
import {getServerSidePropsPost} from '../../../../src/utils/ssr';
Expand Down
2 changes: 1 addition & 1 deletion pages/[lang]/analysis/new/chara.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {AnalysisFormCharaNew} from '../../../../src/components/elements/posts/analysis/form/chara/new';
import {AnalysisFormCharaNew} from '../../../../src/components/pages/posts/analysis/form/chara/new';


export default AnalysisFormCharaNew;
2 changes: 1 addition & 1 deletion pages/[lang]/analysis/new/dragon.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {AnalysisFormDragonNew} from '../../../../src/components/elements/posts/analysis/form/dragon/new';
import {AnalysisFormDragonNew} from '../../../../src/components/pages/posts/analysis/form/dragon/new';


export default AnalysisFormDragonNew;
6 changes: 3 additions & 3 deletions pages/[lang]/ex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import Row from 'react-bootstrap/Row';

import {CharaExAbilityDataEntry, ConditionEnumMap} from '../../src/api-def/resources';
import {useFetchState} from '../../src/components/elements/common/fetch';
import {ExAbilityInput} from '../../src/components/elements/gameData/ex/in/main';
import {InputData} from '../../src/components/elements/gameData/ex/in/types';
import {ExAbilityOutput} from '../../src/components/elements/gameData/ex/out/main';
import {ExAbilityInput} from '../../src/components/pages/gameData/ex/in/main';
import {InputData} from '../../src/components/pages/gameData/ex/in/types';
import {ExAbilityOutput} from '../../src/components/pages/gameData/ex/out/main';
import {scrollRefToTop} from '../../src/utils/scroll';
import {GoogleAnalytics} from '../../src/utils/services/ga';
import {ResourceLoader} from '../../src/utils/services/resources/loader';
Expand Down
2 changes: 1 addition & 1 deletion pages/[lang]/info/[id].tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {UnitInfo} from '../../../src/components/elements/gameData/unitInfo/output/main';
import {UnitInfo} from '../../../src/components/pages/gameData/unitInfo/output/main';


export default UnitInfo;
2 changes: 1 addition & 1 deletion pages/[lang]/info/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {UnitInfoLookup} from '../../../src/components/elements/gameData/unitInfo/lookup/main';
import {UnitInfoLookup} from '../../../src/components/pages/gameData/unitInfo/lookup/main';


export default UnitInfoLookup;
4 changes: 4 additions & 0 deletions pages/[lang]/name.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import {UnitNameRefPage} from '../../src/components/pages/gameData/nameRef/main';


export default UnitNameRefPage;
2 changes: 1 addition & 1 deletion pages/[lang]/quest/[pid].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {GetServerSideProps} from 'next';
import {getSession} from 'next-auth/client';

import {QuestPostGetResponse} from '../../../src/api-def/api';
import {QuestPostOutput} from '../../../src/components/elements/posts/quest/output/main';
import {QuestPostOutput} from '../../../src/components/pages/posts/quest/output/main';
import {ApiRequestSender} from '../../../src/utils/services/api/requestSender';
import {getServerSidePropsPost} from '../../../src/utils/ssr';
import Error404 from '../../404';
Expand Down
2 changes: 1 addition & 1 deletion pages/[lang]/quest/[pid]/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {GetServerSideProps} from 'next';
import {getSession} from 'next-auth/client';

import {QuestPostGetResponse} from '../../../../src/api-def/api';
import {QuestEditForm} from '../../../../src/components/elements/posts/quest/form/edit';
import {QuestEditForm} from '../../../../src/components/pages/posts/quest/form/edit';
import {ApiRequestSender} from '../../../../src/utils/services/api/requestSender';
import {getServerSidePropsPost} from '../../../../src/utils/ssr';
import Error404 from '../../../404';
Expand Down
10 changes: 5 additions & 5 deletions pages/[lang]/quest/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';

import {QuestPostList} from '../../../src/components/elements/posts/quest/list/list';
import {PostListPage} from '../../../src/components/elements/posts/shared/list/page';
import {PostListPage} from '../../../src/components/elements/posts/list/page';
import {QuestPostList} from '../../../src/components/pages/posts/quest/list/list';
import {GeneralPath, PostPath} from '../../../src/const/path/definitions';
import {useI18n} from '../../../src/i18n/hook';
import {makePostPath} from '../../../src/utils/path/make';
import {makePostUrl} from '../../../src/utils/path/make';
import {ApiRequestSender} from '../../../src/utils/services/api/requestSender';


Expand All @@ -18,13 +18,13 @@ const QuestList = () => {
title={title}
fnFetchList={ApiRequestSender.questList}
postManageBarProps={{
newButtons: [{url: GeneralPath.QUEST_NEW}],
newButtons: [{pathname: GeneralPath.QUEST_NEW}],
}}
renderPostEntries={(response) => (
<QuestPostList
entries={response.posts}
generateLink={(postId) => (
makePostPath(PostPath.QUEST, {pid: postId, lang})
makePostUrl(PostPath.QUEST, {pid: postId, lang})
)}
/>
)}
Expand Down
2 changes: 1 addition & 1 deletion pages/[lang]/quest/new.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {QuestNewForm} from '../../../src/components/elements/posts/quest/form/new';
import {QuestNewForm} from '../../../src/components/pages/posts/quest/form/new';


export default QuestNewForm;
2 changes: 1 addition & 1 deletion pages/[lang]/skill/atk.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {AttackingSkillLookup} from '../../../src/components/elements/gameData/skillAtk/main';
import {AttackingSkillLookup} from '../../../src/components/pages/gameData/skillAtk/main';


export default AttackingSkillLookup;
5 changes: 4 additions & 1 deletion pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ NextApp.getInitialProps = async (appContext: AppContext): Promise<AppInitialProp
...await getPageMeta(appContext),
isNotFound: appContext.ctx.res?.statusCode === 404,
session,
simpleUnitInfo: await ResourceLoader.getSimpleUnitInfo(),
resources: {
simpleUnitInfo: await ResourceLoader.getSimpleUnitInfo(),
afflictions: await ResourceLoader.getEnumAfflictionStatus(),
},
};

appProps.pageProps = pageProps;
Expand Down
4 changes: 0 additions & 4 deletions pm2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ apps:
# Execution configs
exec_mode: 'cluster'
instances: 6
# Watch
watch_delay: 10000
ignore_watch:
- 'node_modules'
# Environments
env:
NODE_ENV: 'development'
Expand Down
35 changes: 35 additions & 0 deletions src/components/elements/common/buttonBar.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from 'react';

import {screen} from '@testing-library/react';

import {renderReact} from '../../../../test/render/main';
import {SupportedLanguages} from '../../../api-def/api';
import {GeneralPath, PATH_ROOT} from '../../../const/path/definitions';
import {ButtonBar} from './buttonBar';


describe('Button bar', () => {
it('prepends language to the button link', async () => {
renderReact(() => <ButtonBar buttons={[
{pathname: GeneralPath.ABOUT, text: 'About', variant: 'primary'},
]}/>);

expect(screen.getByText('About')).toHaveAttribute('href', `/${SupportedLanguages.EN}${GeneralPath.ABOUT}`);
});

it('ignores the language passed in and attaches the current language', async () => {
renderReact(() => <ButtonBar buttons={[
{pathname: `/${SupportedLanguages.CHT}${GeneralPath.ABOUT}`, text: 'About', variant: 'primary'},
]}/>);

expect(screen.getByText('About')).toHaveAttribute('href', `/${SupportedLanguages.EN}${GeneralPath.ABOUT}`);
});

it('handles language-sensitive pathname correctly', async () => {
renderReact(() => <ButtonBar buttons={[
{pathname: `${PATH_ROOT}${GeneralPath.ABOUT}`, text: 'About', variant: 'primary'},
]}/>);

expect(screen.getByText('About')).toHaveAttribute('href', `/${SupportedLanguages.EN}${GeneralPath.ABOUT}`);
});
});
50 changes: 50 additions & 0 deletions src/components/elements/common/buttonBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import React from 'react';

import Button from 'react-bootstrap/Button';
import Col from 'react-bootstrap/Col';
import Row from 'react-bootstrap/Row';
import {ButtonVariant} from 'react-bootstrap/types';

import {useI18n} from '../../../i18n/hook';
import {pathnameRemoveLang, urlRemoveLang} from '../../../utils/path/process';
import {NextLink} from './link';


export type ButtonEntry = {
pathname: string,
variant: ButtonVariant,
text: string,
}

export type ButtonBarProps = {
buttons: Array<ButtonEntry>,
bottomMarginClass?: string
}

export const ButtonBar = ({buttons, bottomMarginClass}: ButtonBarProps) => {
const {lang} = useI18n();

const buttonClassNames = `float-right ml-2 ${bottomMarginClass ?? 'mb-3'}`;

return (
<Row>
<Col>
{
buttons.map(({pathname, text, variant}, idx) => {
// Ensure pathname won't have language prepended
pathname = pathnameRemoveLang(pathname);
pathname = urlRemoveLang(pathname);

return (
<NextLink href={pathname} locale={lang} key={idx} passHref>
<Button variant={variant} className={buttonClassNames}>
{text}
</Button>
</NextLink>
);
})
}
</Col>
</Row>
);
};
2 changes: 0 additions & 2 deletions src/components/elements/express.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import Badge from 'react-bootstrap/Badge';
import Col from 'react-bootstrap/Col';
import Row from 'react-bootstrap/Row';

import {useI18n} from '../../../../i18n/hook';
import {useAtkSkillResources} from '../../../hooks/atkSkillResources';
import {useI18n} from '../../../i18n/hook';
import {useAtkSkillResources} from '../../hooks/atkSkillResources';


type ConditionBadgeProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';

import {InfoPopover} from '../../common/overlay/info';
import {DetailedProps} from '../../common/types';
import {InfoPopover} from '../common/overlay/info';
import {DetailedProps} from '../common/types';


export const SectionSubTitle = ({title, description}: DetailedProps) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';

import {InfoPopover} from '../../common/overlay/info';
import {DetailedProps} from '../../common/types';
import {InfoPopover} from '../common/overlay/info';
import {DetailedProps} from '../common/types';


export const SectionTitle = ({title, description}: DetailedProps) => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/elements/input/entry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {RadioGroup} from '../common/check/group/radio';
import {CheckboxInput} from '../common/check/item/checkbox';
import {CheckOption} from '../common/check/types';
import {NumericInput} from '../common/input/numeric';
import {SectionSubTitle} from '../gameData/elements/subTitle';
import {SectionTitle} from '../gameData/elements/title';
import {SectionSubTitle} from '../gameData/subTitle';
import {SectionTitle} from '../gameData/title';
import {InputEntryProps} from './types';


Expand Down
3 changes: 2 additions & 1 deletion src/components/elements/markdown/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {renderLink} from './components/link';
import {renderListItem} from './components/listItem';
import {renderParagraph} from './components/paragraph';
import {renderStrong} from './components/strong';
import {renderTable, renderTableCell, renderTableRow} from './components/table';
import {renderTable, renderTableCell, renderTableHeader, renderTableRow} from './components/table';


// Key correspondences:
Expand All @@ -25,6 +25,7 @@ export const components: Components = {
h6: renderHeading,
strong: renderStrong,
table: renderTable,
th: renderTableHeader,
tr: renderTableRow,
td: renderTableCell,
li: renderListItem,
Expand Down
8 changes: 8 additions & 0 deletions src/components/elements/markdown/components/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ export const renderTable = ({children, node}: MarkdownComponentProps) => {
return <table>{children}</table>;
};

export const renderTableHeader = ({children}: MarkdownComponentProps) => (
<th>
<TextChildren>
{children}
</TextChildren>
</th>
);

export const renderTableRow: TableRowComponent = ({children}) => {
idxCounter = 0;

Expand Down
Loading