Skip to content

Commit

Permalink
fix(app): subItem, settings container (#1214)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimakorzhovnik authored Jul 29, 2024
2 parents 96b9b2b + 6931dd3 commit fc8df10
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/components/appMenu/SubMenu/SubMenu.module.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$icon-size: 25px;
$icon-size: 16px;

.subMenu {
// position: absolute;
Expand All @@ -24,7 +24,7 @@ $icon-size: 25px;
gap: 7px;
align-items: center;
padding-left: 20px;
font-size: 18px;
font-size: 16px;
// >div {
// align-items: center;
// flex-shrink: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import styles from './AppName.module.scss';
function AppName() {
let { pathname } = useLocation();
const isRobot = pathname.includes('@') || pathname.includes('neuron/');
const isOracle = pathname.includes('oracle');

if (isRobot) {
const pathnameArr = pathname.replace(/^\/|\/$/g, '').split('/');
Expand All @@ -20,6 +21,10 @@ function AppName() {
: findItem;
}

if (isOracle) {
pathname = routes.oracle.path;
}

const value = findApp(getMenuItems(), pathname);

const content = value[0]?.name || CHAIN_ID;
Expand Down
3 changes: 2 additions & 1 deletion src/pages/Settings/Layout/Layout.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ $size-columns: 200px;

.wrapper {
display: grid;
grid-template-columns: $size-columns minmax($size-columns, calc(62% - $size-columns));
grid-template-columns: $size-columns minmax($size-columns, 1fr);
grid-template-rows: 1fr;
justify-content: center;

Expand All @@ -25,6 +25,7 @@ $size-columns: 200px;

> :nth-child(2) {
left: -2px;
margin-right: -2px;
position: relative;
overflow-x: auto;
}
Expand Down
17 changes: 10 additions & 7 deletions src/pages/Settings/Layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import { Outlet } from 'react-router-dom';
import { Helmet } from 'react-helmet';
import { MainContainer } from 'src/components';
import SettingsMenu from './SettingsMenu/SettingsMenu';
import styles from './Layout.module.scss';

function Layout() {
return (
<div className={styles.wrapper}>
<Helmet>
<title>setting | cyb</title>
</Helmet>
<MainContainer>
<div className={styles.wrapper}>
<Helmet>
<title>setting | cyb</title>
</Helmet>

<SettingsMenu />
<SettingsMenu />

<Outlet />
</div>
<Outlet />
</div>
</MainContainer>
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/utils/appsMenu/appsMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { CHAIN_ID } from 'src/constants/config';
const getMenuItems = () => {
const listItemMenu = [
{
name: 'My robot',
name: 'robot',
icon: robot,
to: '/robot',
subItems: [
Expand All @@ -39,7 +39,7 @@ const getMenuItems = () => {
{
name: 'Particles',
to: '/particles',
icon: require('./images/horizontal-traffic-light.png'),
icon: require('./images/tag@2x.png'),
},
{
name: 'Stats',
Expand Down
4 changes: 2 additions & 2 deletions src/utils/findApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const findApp = (menuItems: MenuItems, url: string) => {
if (item.to === url) {
acc.push(item);
} else if (findSubItemFc(item.subItems, url).length !== 0) {
const findSubItem = findSubItemFc(item.subItems, url);
acc.push({ ...item, name: findSubItem[0].name });
// const findSubItem = findSubItemFc(item.subItems, url);
acc.push(item);
}
return acc;
}, []);
Expand Down

0 comments on commit fc8df10

Please sign in to comment.