Skip to content

Commit

Permalink
Add alias to finances page (#743)
Browse files Browse the repository at this point in the history
Signed-off-by: Cintia Sánchez García <[email protected]>
  • Loading branch information
cynthia-sg authored Nov 1, 2024
1 parent bb5bcef commit 0bb10f2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions ui/webapp/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import { batch, createEffect, createSignal, on, onMount, Show } from 'solid-js';

import styles from './App.module.css';
import {
ACQUISITIONS_PATH,
EMBED_SETUP_PATH,
EXPLORE_PATH,
FINANCES_PATH,
FUNDING_PATH,
GAMES_PATH,
GUIDE_PATH,
LOGOS_PREVIEW_PATH,
Expand Down Expand Up @@ -178,6 +180,8 @@ const App = () => {
<Route path={STATS_PATH} component={Stats} />
<Route path={GAMES_PATH} component={Games} />
<Route path={FINANCES_PATH} component={Finances} />
<Route path={FUNDING_PATH} component={Finances} />
<Route path={ACQUISITIONS_PATH} component={Finances} />
<Route path={PROJECTS_PATH} component={Projects} />
<Route path={LOGOS_PREVIEW_PATH} component={Logos} />
<Route path="*" component={NotFound} />
Expand Down
2 changes: 2 additions & 0 deletions ui/webapp/src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export const EMBED_SETUP_PATH = `${BASE_PATH}/embed-setup`;
export const STATS_PATH = `${BASE_PATH}/stats`;
export const GUIDE_PATH = `${BASE_PATH}/guide`;
export const FINANCES_PATH = `${BASE_PATH}/finances`;
export const FUNDING_PATH = `${BASE_PATH}/funding`;
export const ACQUISITIONS_PATH = `${BASE_PATH}/acquisitions`;
export const PROJECTS_PATH = `${BASE_PATH}/projects`;
export const GAMES_PATH = `${BASE_PATH}/games`;
export const LOGOS_PREVIEW_PATH = `${BASE_PATH}/logos-preview`;
Expand Down
11 changes: 6 additions & 5 deletions ui/webapp/src/layout/finances/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import moment from 'moment';
import { batch, createEffect, createSignal, For, Match, on, onMount, Show, Switch } from 'solid-js';

import {
ACQUISITIONS_PATH,
DEFAULT_FINANCES_KIND,
FINANCES_KIND_PARAM,
FOUNDATION,
Expand Down Expand Up @@ -100,12 +101,14 @@ const filterFinances = (
const Finances = () => {
const navigate = useNavigate();
const location = useLocation();
// When the location is .../acquisitions, the default kind is FinancesKind.Acquisitions
const DEFAULT_KIND = location.pathname === ACQUISITIONS_PATH ? FinancesKind.Acquisitions : DEFAULT_FINANCES_KIND;
const fullDataReady = useFullDataReady();
const financesData = useFinancesDataContent();
const setFinancesData = useSetFinancesDataContent();
const [data, setData] = createSignal<FinancesData | null>();
const [visibleData, setVisibleData] = createSignal<FundingData[] | AcquisitionData[]>();
const [selectedKind, setSelectedKind] = createSignal<FinancesKind>(DEFAULT_FINANCES_KIND);
const [selectedKind, setSelectedKind] = createSignal<FinancesKind>(DEFAULT_KIND);
const [selectedSortOption, setSelectedSortOption] = createSignal<SortOption>({
by: DEFAULT_SORT_BY,
direction: DEFAULT_SORT_DIRECTION,
Expand All @@ -119,7 +122,7 @@ const Finances = () => {
const prepareQuery = () => {
if (location.search === '') {
navigate(
`${location.pathname}?${FINANCES_KIND_PARAM}=${DEFAULT_FINANCES_KIND}&${PAGE_PARAM}=1&${SORT_BY_PARAM}=${DEFAULT_SORT_BY}&${SORT_DIRECTION_PARAM}=${DEFAULT_SORT_DIRECTION}`,
`${location.pathname}?${FINANCES_KIND_PARAM}=${DEFAULT_KIND}&${PAGE_PARAM}=1&${SORT_BY_PARAM}=${DEFAULT_SORT_BY}&${SORT_DIRECTION_PARAM}=${DEFAULT_SORT_DIRECTION}`,
{
replace: true,
scroll: true, // default
Expand All @@ -142,9 +145,7 @@ const Finances = () => {
batch(() => {
setActiveFilters(currentFilters);
setSelectedKind(
!isNull(params.get(FINANCES_KIND_PARAM))
? (params.get(FINANCES_KIND_PARAM) as FinancesKind)
: DEFAULT_FINANCES_KIND
!isNull(params.get(FINANCES_KIND_PARAM)) ? (params.get(FINANCES_KIND_PARAM) as FinancesKind) : DEFAULT_KIND
);
setPageNumber(!isNull(params.get(PAGE_PARAM)) ? parseInt(params.get(PAGE_PARAM)!) : 1);
setOffset(
Expand Down

0 comments on commit 0bb10f2

Please sign in to comment.