-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into perf/dashboard-test
- Loading branch information
Showing
15 changed files
with
5,035 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { StorybookConfig } from '@storybook/react-vite' | ||
|
||
const config: StorybookConfig = { | ||
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], | ||
addons: [ | ||
'@storybook/addon-links', | ||
'@storybook/addon-essentials', | ||
'@storybook/addon-onboarding', | ||
'@storybook/addon-interactions', | ||
], | ||
framework: { | ||
name: '@storybook/react-vite', | ||
options: {}, | ||
}, | ||
docs: { | ||
autodocs: 'tag', | ||
}, | ||
} | ||
export default config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { Preview } from '@storybook/react' | ||
import React from 'react' | ||
|
||
const preview: Preview = { | ||
parameters: { | ||
actions: { argTypesRegex: '^on[A-Z].*' }, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
}, | ||
}, | ||
decorators: [ | ||
(Story) => ( | ||
<div style={{ direction: 'rtl' }}> | ||
<Story /> | ||
</div> | ||
), | ||
], | ||
} | ||
|
||
export default preview |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,7 +55,9 @@ | |
"test:unit:ci": "vitest run", | ||
"lint": "eslint . --max-warnings 0", | ||
"lint:fix": "eslint . --fix", | ||
"format": "prettier --write './**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc" | ||
"format": "prettier --write './**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc", | ||
"storybook": "storybook dev -p 6006", | ||
"build-storybook": "storybook build" | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
|
@@ -71,6 +73,14 @@ | |
}, | ||
"devDependencies": { | ||
"@playwright/test": "^1.37.1", | ||
"@storybook/addon-essentials": "^7.5.3", | ||
"@storybook/addon-interactions": "^7.5.3", | ||
"@storybook/addon-links": "^7.5.3", | ||
"@storybook/addon-onboarding": "^1.0.8", | ||
"@storybook/blocks": "^7.5.3", | ||
"@storybook/react": "^7.5.3", | ||
"@storybook/react-vite": "^7.5.3", | ||
"@storybook/testing-library": "^0.2.2", | ||
"@testing-library/jest-dom": "^6.1.3", | ||
"@testing-library/react": "^14.0.0", | ||
"@testing-library/user-event": "^14.5.1", | ||
|
@@ -87,11 +97,12 @@ | |
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"eslint-plugin-react": "^7.33.2", | ||
"eslint-plugin-storybook": "^0.6.15", | ||
"jsdom": "^22.1.0", | ||
"openapi-typescript-codegen": "^0.23.0", | ||
"playwright-advanced-har": "^1.2.1", | ||
"prettier": "^2.7.1", | ||
"storybook": "^7.5.3", | ||
"vitest": "^0.34.6" | ||
}, | ||
"packageManager": "[email protected]" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { FC, PropsWithChildren, createContext, useState } from 'react' | ||
|
||
export interface LayoutContextInterface { | ||
setDrawerOpen: (isOpen: boolean) => void | ||
drawerOpen: boolean | ||
} | ||
export const LayoutCtx = createContext({} as LayoutContextInterface) | ||
const LayoutContext: FC<PropsWithChildren> = ({ children }) => { | ||
const [drawerOpen, setDrawerOpen] = useState(false) | ||
return <LayoutCtx.Provider value={{ drawerOpen, setDrawerOpen }}>{children}</LayoutCtx.Provider> | ||
} | ||
export default LayoutContext |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
import { BusToolTip, BusToolTipProps } from './BusToolTip' | ||
|
||
const meta = { | ||
title: 'Components/MapLayers/BusToolTip', | ||
component: BusToolTip, | ||
parameters: { | ||
layout: 'centered', | ||
}, | ||
tags: ['map', 'tooltip', 'autodocs'], | ||
} satisfies Meta<typeof BusToolTip> | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof meta> | ||
|
||
const defaultArgs: BusToolTipProps = { | ||
position: { | ||
loc: [31.799982, 34.786926], | ||
color: 22, | ||
operator: 3, | ||
bearing: 106, | ||
recorded_at_time: 1698809440000, | ||
point: { | ||
id: 2838516282, | ||
siri_snapshot_id: 919509, | ||
siri_ride_stop_id: 1370461085, | ||
recorded_at_time: '2023-11-01T03:30:40+00:00', | ||
lon: 34.786926, | ||
lat: 31.799982, | ||
bearing: 106, | ||
velocity: 22, | ||
distance_from_journey_start: 636, | ||
distance_from_siri_ride_stop_meters: 278, | ||
siri_snapshot__snapshot_id: '2023/11/01/03/30', | ||
siri_route__id: 973, | ||
siri_route__line_ref: 2974, | ||
siri_route__operator_ref: 3, | ||
siri_ride__id: 52703935, | ||
siri_ride__journey_ref: '2023-11-01-56650774', | ||
siri_ride__scheduled_start_time: '2023-11-01T03:30:00+00:00', | ||
siri_ride__vehicle_ref: '23321002', | ||
siri_ride__first_vehicle_location_id: 2838509585, | ||
siri_ride__last_vehicle_location_id: 2838555351, | ||
siri_ride__duration_minutes: 27, | ||
siri_ride__gtfs_ride_id: 57365030, | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
} as any, | ||
}, | ||
icon: '/bus-logos/3.svg', | ||
} | ||
|
||
export const Default: Story = { | ||
args: defaultArgs, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Layout } from 'antd' | ||
import { MenuOutlined } from '@ant-design/icons' | ||
import { useContext } from 'react' | ||
import { LayoutContextInterface, LayoutCtx } from 'src/layout/LayoutContext' | ||
|
||
const { Header } = Layout | ||
|
||
const MainHeader = () => { | ||
const { setDrawerOpen } = useContext<LayoutContextInterface>(LayoutCtx) | ||
return ( | ||
<Header style={{ background: 'white' }} className="hideOnDesktop"> | ||
<MenuOutlined onClick={() => setDrawerOpen(true)} /> | ||
</Header> | ||
) | ||
} | ||
export default MainHeader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,33 @@ | ||
import { useState } from 'react' | ||
import Menu from './menu/Menu' | ||
import { MenuOutlined } from '@ant-design/icons' | ||
import './sidebar.scss' | ||
import cn from 'classnames' | ||
import { Drawer } from 'antd' | ||
import { useContext } from 'react' | ||
import { LayoutContextInterface, LayoutCtx } from 'src/layout/LayoutContext' | ||
|
||
const SidebarToggle = ({ open, setOpen }: { open: boolean; setOpen: (open: boolean) => void }) => ( | ||
<div className="sidebar-menu-toggle" onClick={() => setOpen(!open)}> | ||
<MenuOutlined /> | ||
const Logo = () => ( | ||
<div style={{ overflow: 'hidden' }}> | ||
<h1 className={'sidebar-logo'}>דאטאבוס</h1> | ||
</div> | ||
) | ||
|
||
const Logo = () => <h1 className={'sidebar-logo'}>דאטאבוס</h1> | ||
|
||
export default function SideBar() { | ||
const [open, setOpen] = useState(false) | ||
const { drawerOpen, setDrawerOpen } = useContext<LayoutContextInterface>(LayoutCtx) | ||
|
||
return ( | ||
<aside className={cn('sidebar', { open })}> | ||
<Logo /> | ||
<SidebarToggle open={open} setOpen={setOpen} /> | ||
<Menu /> | ||
</aside> | ||
<> | ||
<Drawer | ||
placement="right" | ||
mask | ||
width={280} | ||
onClose={() => setDrawerOpen(false)} | ||
open={drawerOpen} | ||
className="hideOnDesktop"> | ||
<Menu /> | ||
</Drawer> | ||
<aside className={'sidebar hideOnMobile'}> | ||
<Logo /> | ||
<Menu /> | ||
</aside> | ||
</> | ||
) | ||
} |
Oops, something went wrong.