Skip to content

Commit

Permalink
Merge pull request #745 from MAIF/feat/#741
Browse files Browse the repository at this point in the history
feat #741: update logo link to redirect on / instead of /apis
  • Loading branch information
quentinovega authored Sep 4, 2024
2 parents 40fcdba + 6260446 commit cad25d6
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 19 deletions.
7 changes: 4 additions & 3 deletions daikoku/javascript/src/components/frontend/MaybeHomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ export const MaybeHomePage = ({
if (message) {
toast.success(translate(message))
}

if (!tenant.homePageVisible || connectedUser?._humanReadableId) {
console.log('homePageVisible', tenant.homePageVisible);
if (tenant.homePageVisible) {
window.location.replace('/_/');
} else
navigate('/apis');
} else window.location.replace('/_/');
}, []);

return null;
Expand Down
31 changes: 19 additions & 12 deletions daikoku/javascript/src/components/utils/sidebar/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Plus from 'react-feather/dist/icons/plus';
import Search from 'react-feather/dist/icons/search';
import Zap from 'react-feather/dist/icons/zap';
import { Link, useLocation } from 'react-router-dom';

import RectangleList from 'react-feather/dist/icons/list';
import { I18nContext } from '../../../contexts/i18n-context';
import { GlobalContext } from '../../../contexts/globalContext';
import * as Services from '../../../services';
Expand Down Expand Up @@ -60,17 +60,24 @@ export const SideBar = () => {
<div className="navbar-container d-flex flex-row">
<div className="navbar d-flex flex-column p-2 align-items-center justify-content-between">
<div className="navbar_top d-flex flex-column align-items-center">
<Link
to="/apis"
title="Daikoku home"
aria-label='Go home'
className="mb-3 brand"
>
<img
src={tenant.logo}
alt={translate('tenant.logo')}
/>
</Link>
<a
href={'/'}
title="Daikoku home"
aria-label="Go home"
className="mb-3 brand"
>
<img src={tenant.logo} alt={translate("tenant.logo")} />
</a>
<div className="nav_item mb-3 cursor-pointer">
<Link
to="/apis"
title="list apis"
aria-label="Access to list apis"
className="mb-3 brand"
>
<RectangleList />
</Link>
</div>

{!connectedUser.isGuest && (
<>
Expand Down
4 changes: 2 additions & 2 deletions daikoku/javascript/tests/completeJourney.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test('test a complete user journey', async ({ page }) => {
// FIXME: find the fine selector to check user is connected

//create a new team
await page.locator('div:nth-child(3) > .notification-link').first().click();
await page.locator('div:nth-child(4) > .notification-link').first().click();
await page.getByRole('button', { name: '' }).first().click();
await page.getByLabel('Name').fill('The A team');
await page.getByLabel('Description').fill('the A team');
Expand All @@ -39,7 +39,7 @@ test('test a complete user journey', async ({ page }) => {
await page.locator('.navbar-panel-background').click();

//create a new API
await page.locator('div:nth-child(3) > .notification-link').first().click();
await page.locator('div:nth-child(4) > .notification-link').first().click();
await page.locator('span').filter({ hasText: 'API' }).first().click();
await page.locator('div').filter({ hasText: /^The A team$/ }).click();

Expand Down
2 changes: 1 addition & 1 deletion daikoku/javascript/tests/connectedUser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ test('Create & manage API', async ({ page }) => {
await page.getByPlaceholder('Password').fill('password');
await page.getByPlaceholder('Password').press('Enter');
//create new API
await page.locator('div:nth-child(3) > .notification-link').first().click();
await page.locator('div:nth-child(4) > .notification-link').first().click();
await page.locator('span').filter({ hasText: 'API' }).first().click();
await page.locator('#portal-root div').filter({ hasText: /^Testers$/ }).click();
await page.getByRole('button', { name: 'Published' }).click();
Expand Down
2 changes: 1 addition & 1 deletion daikoku/javascript/tests/manageMembers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test('manage team as admin', async ({ page }) => {
await page.getByPlaceholder('Email adress').fill('[email protected]');
await page.getByPlaceholder('Password').fill('password');
await page.getByPlaceholder('Password').press('Enter');
await page.locator('div:nth-child(3) > .notification-link').first().click();
await page.locator('div:nth-child(4) > .notification-link').first().click();
await page.locator('span.block__entry__link').filter({ hasText: 'Team' }).first().click();
await page.getByLabel('Name').fill('komainu');
await page.getByRole('button', { name: 'Create' }).click();
Expand Down
2 changes: 2 additions & 0 deletions daikoku/javascript/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export default defineConfig({
publicDir: "public",
server: {
proxy: {
"/_": "http://localhost:9000",
"/cms": "http://localhost:9000",
"/api/": "http://localhost:9000",
"/account": "http://localhost:9000",
"/auth/Local/callback": "http://localhost:9000",
Expand Down

0 comments on commit cad25d6

Please sign in to comment.