Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update storybook #85

Merged
merged 3 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
module.exports = {
import type { StorybookConfig } from '@storybook/react-vite';

const config: StorybookConfig = {
stories: ["../stories/**/*.stories.tsx"],
addons: ["@storybook/addon-actions"],
framework: "@storybook/react-vite",
};

export default config;
File renamed without changes.
29 changes: 13 additions & 16 deletions db-viewer-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,20 @@
"tslib": "^2.3.0"
},
"devDependencies": {
"@skbkontur/icons": "^1.3.0",
"@skbkontur/icons": "^1.7.3",
"@skbkontur/react-selenium-testing": "^0.2.1",
"@skbkontur/react-ui": "^4.1.0",
"@storybook/addon-actions": "^7.0.7",
"@storybook/addons": "^7.0.7",
"@storybook/cli": "^7.4.6",
"@storybook/react": "^7.0.7",
"@storybook/react-vite": "^7.4.6",
"@storybook/addon-actions": "^7.6.8",
"@storybook/addons": "^7.6.8",
"@storybook/cli": "^7.6.8",
"@storybook/react": "^7.6.8",
"@storybook/react-vite": "^7.6.8",
"@types/lodash": "^4.14.171",
"@types/react": "^17.0.15",
"@types/react-dom": "^17.0.15",
"@types/react-router": "^5.1.16",
"@types/react-router-dom": "^5.1.8",
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"@vitejs/plugin-react": "^3.0.1",
"@vitejs/plugin-react": "^4.2.1",
"copyfiles": "^2.4.1",
"eslint": "^8.50.0",
"eslint-config-prettier": "^9.0.0",
Expand All @@ -80,16 +78,15 @@
"eslint-plugin-react": "^7.24.0",
"jsdom": "^22.1.0",
"npm-run-all": "^4.1.5",
"prettier": "^3.0.3",
"prettier": "^3.2.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-refresh": "^0.10.0",
"react-router-dom": "^6.11.1",
"react-router-dom": "^6.21.2",
"rimraf": "^3.0.2",
"storybook-addon-react-router-v6": "^2.0.7",
"typescript": "^4.3.5",
"vite": "^4.4.9",
"vitest": "^0.30.1"
"storybook-addon-react-router-v6": "^2.0.10",
"typescript": "^5.3.3",
"vite": "^5.0.11",
"vitest": "^1.2.0"
},
"packageManager": "[email protected]+sha256.825003a0f561ad09a3b1ac4a3b3ea6207af2796d54f62a9420520915721f5186"
}
2 changes: 2 additions & 0 deletions db-viewer-ui/src/Containers/ObjectDetailsContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ export const ObjectDetailsContainer = ({
<ObjectKeys
keys={(objectMeta?.typeMetaInformation?.properties || [])
.filter(x => x.isIdentity)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
.map(x => ({ name: x.name, value: String(objectInfo[x.name]) }))}
/>
</CommonLayout.Header>
Expand Down
4 changes: 4 additions & 0 deletions db-viewer-ui/src/Containers/ObjectTableContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ export const ObjectTableContainer = ({
return properties
.filter(x => x.isIdentity)
.map(x => ({
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
value: item[x.name],
path: x.name,
operator: ObjectFieldFilterOperator.Equals,
Expand All @@ -380,6 +382,8 @@ export const ObjectTableContainer = ({
const query = {};
for (const prop of properties) {
if (prop.isIdentity) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
query[prop.name] = item[prop.name];
}
}
Expand Down
2 changes: 1 addition & 1 deletion db-viewer-ui/src/Domain/ApiBase/ApiBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ interface ParamsMap {
[key: string]: null | undefined | number | string | any[] | boolean;
}

function getExceptionInfo(exception: object, path: string): string {
function getExceptionInfo(exception: any, path: string): string {
return (
exception["Exception" + path] ||
exception["exception" + path] ||
Expand Down
19 changes: 5 additions & 14 deletions db-viewer-ui/stories/Themes/ObjectDetails.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
import {
DEFAULT_THEME,
DEFAULT_THEME_8PX_OLD,
FLAT_THEME_8PX_OLD,
ThemeContext,
ThemeFactory,
} from "@skbkontur/react-ui";
import { DEFAULT_THEME, DARK_THEME, THEME_2022, THEME_2022_DARK, ThemeContext } from "@skbkontur/react-ui";
import { Theme } from "@skbkontur/react-ui/lib/theming/Theme";
import React from "react";
import { MemoryRouter, Route } from "react-router";
import { Routes } from "react-router-dom";
import { MemoryRouter, Route, Routes } from "react-router-dom";

import { NullCustomRenderer } from "../../src";
import { ObjectDetailsContainer } from "../../src/Containers/ObjectDetailsContainer";
import { DbViewerApiFake } from "../Api/DbViewerApiFake";

import { reactUiDark } from "./reactUiDark";

export default {
title: "Themes/ObjectDetails",
};
Expand All @@ -41,6 +32,6 @@ const DetailsContainer = ({ theme }: { theme: Theme }) => (
);

export const Default = (): React.ReactElement => <DetailsContainer theme={DEFAULT_THEME} />;
export const Flat = (): React.ReactElement => <DetailsContainer theme={FLAT_THEME_8PX_OLD} />;
export const Old = (): React.ReactElement => <DetailsContainer theme={DEFAULT_THEME_8PX_OLD} />;
export const Dark = (): React.ReactElement => <DetailsContainer theme={ThemeFactory.create(reactUiDark)} />;
export const Dark = (): React.ReactElement => <DetailsContainer theme={DARK_THEME} />;
export const Theme2022 = (): React.ReactElement => <DetailsContainer theme={THEME_2022} />;
export const Theme2022Dark = (): React.ReactElement => <DetailsContainer theme={THEME_2022_DARK} />;
16 changes: 4 additions & 12 deletions db-viewer-ui/stories/Themes/ObjectError.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
DEFAULT_THEME,
DEFAULT_THEME_8PX_OLD,
FLAT_THEME_8PX_OLD,
ThemeContext,
ThemeFactory,
} from "@skbkontur/react-ui";
import { DEFAULT_THEME, DARK_THEME, THEME_2022, THEME_2022_DARK, ThemeContext } from "@skbkontur/react-ui";
import { Theme } from "@skbkontur/react-ui/lib/theming/Theme";
import React from "react";
import { MemoryRouter, Route, Routes } from "react-router-dom";
Expand All @@ -13,8 +7,6 @@ import { NullCustomRenderer } from "../../src";
import { ObjectDetailsContainer } from "../../src/Containers/ObjectDetailsContainer";
import { DbViewerApiFake } from "../Api/DbViewerApiFake";

import { reactUiDark } from "./reactUiDark";

export default {
title: "Themes/ObjectError",
};
Expand All @@ -40,6 +32,6 @@ const ErrorContainer = ({ theme }: { theme: Theme }) => (
);

export const Default = (): React.ReactElement => <ErrorContainer theme={DEFAULT_THEME} />;
export const Flat = (): React.ReactElement => <ErrorContainer theme={FLAT_THEME_8PX_OLD} />;
export const Old = (): React.ReactElement => <ErrorContainer theme={DEFAULT_THEME_8PX_OLD} />;
export const Dark = (): React.ReactElement => <ErrorContainer theme={ThemeFactory.create(reactUiDark)} />;
export const Dark = (): React.ReactElement => <ErrorContainer theme={DARK_THEME} />;
export const Theme2022 = (): React.ReactElement => <ErrorContainer theme={THEME_2022} />;
export const Theme2022Dark = (): React.ReactElement => <ErrorContainer theme={THEME_2022_DARK} />;
19 changes: 5 additions & 14 deletions db-viewer-ui/stories/Themes/ObjectNotFound.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
import {
DEFAULT_THEME,
DEFAULT_THEME_8PX_OLD,
FLAT_THEME_8PX_OLD,
ThemeContext,
ThemeFactory,
} from "@skbkontur/react-ui";
import { DEFAULT_THEME, DARK_THEME, THEME_2022, THEME_2022_DARK, ThemeContext } from "@skbkontur/react-ui";
import { Theme } from "@skbkontur/react-ui/lib/theming/Theme";
import React from "react";
import { MemoryRouter, Route } from "react-router";
import { Routes } from "react-router-dom";
import { MemoryRouter, Route, Routes } from "react-router-dom";

import { NullCustomRenderer } from "../../src";
import { ObjectDetailsContainer } from "../../src/Containers/ObjectDetailsContainer";
import { DbViewerApiFake } from "../Api/DbViewerApiFake";

import { reactUiDark } from "./reactUiDark";

export default {
title: "Themes/ObjectNotFound",
};
Expand All @@ -41,6 +32,6 @@ const DetailsContainer = ({ theme }: { theme: Theme }) => (
);

export const Default = (): React.ReactElement => <DetailsContainer theme={DEFAULT_THEME} />;
export const Flat = (): React.ReactElement => <DetailsContainer theme={FLAT_THEME_8PX_OLD} />;
export const Old = (): React.ReactElement => <DetailsContainer theme={DEFAULT_THEME_8PX_OLD} />;
export const Dark = (): React.ReactElement => <DetailsContainer theme={ThemeFactory.create(reactUiDark)} />;
export const Dark = (): React.ReactElement => <DetailsContainer theme={DARK_THEME} />;
export const Theme2022 = (): React.ReactElement => <DetailsContainer theme={THEME_2022} />;
export const Theme2022Dark = (): React.ReactElement => <DetailsContainer theme={THEME_2022_DARK} />;
16 changes: 4 additions & 12 deletions db-viewer-ui/stories/Themes/ObjectTable.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
DEFAULT_THEME,
DEFAULT_THEME_8PX_OLD,
FLAT_THEME_8PX_OLD,
ThemeContext,
ThemeFactory,
} from "@skbkontur/react-ui";
import { DEFAULT_THEME, DARK_THEME, THEME_2022, THEME_2022_DARK, ThemeContext } from "@skbkontur/react-ui";
import { Theme } from "@skbkontur/react-ui/lib/theming/Theme";
import React from "react";
import { MemoryRouter, Route, Routes } from "react-router-dom";
Expand All @@ -13,8 +7,6 @@ import { NullCustomRenderer } from "../../src";
import { ObjectTableContainer } from "../../src/Containers/ObjectTableContainer";
import { DbViewerApiFake } from "../Api/DbViewerApiFake";

import { reactUiDark } from "./reactUiDark";

export default {
title: "Themes/ObjectTable",
};
Expand All @@ -40,6 +32,6 @@ const TableContainer = ({ theme }: { theme: Theme }) => (
);

export const Default = (): React.ReactElement => <TableContainer theme={DEFAULT_THEME} />;
export const Flat = (): React.ReactElement => <TableContainer theme={FLAT_THEME_8PX_OLD} />;
export const Old = (): React.ReactElement => <TableContainer theme={DEFAULT_THEME_8PX_OLD} />;
export const Dark = (): React.ReactElement => <TableContainer theme={ThemeFactory.create(reactUiDark)} />;
export const Dark = (): React.ReactElement => <TableContainer theme={DARK_THEME} />;
export const Theme2022 = (): React.ReactElement => <TableContainer theme={THEME_2022} />;
export const Theme2022Dark = (): React.ReactElement => <TableContainer theme={THEME_2022_DARK} />;
16 changes: 4 additions & 12 deletions db-viewer-ui/stories/Themes/ObjectTableNoEntries.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
DEFAULT_THEME,
DEFAULT_THEME_8PX_OLD,
FLAT_THEME_8PX_OLD,
ThemeContext,
ThemeFactory,
} from "@skbkontur/react-ui";
import { DEFAULT_THEME, DARK_THEME, THEME_2022, THEME_2022_DARK, ThemeContext } from "@skbkontur/react-ui";
import { Theme } from "@skbkontur/react-ui/lib/theming/Theme";
import React from "react";
import { MemoryRouter, Route, Routes } from "react-router-dom";
Expand All @@ -13,8 +7,6 @@ import { NullCustomRenderer } from "../../src";
import { ObjectTableContainer } from "../../src/Containers/ObjectTableContainer";
import { DbViewerApiFake } from "../Api/DbViewerApiFake";

import { reactUiDark } from "./reactUiDark";

export default {
title: "Themes/ObjectTableZeroEntries",
};
Expand All @@ -40,6 +32,6 @@ const TableContainer = ({ theme }: { theme: Theme }) => (
);

export const Default = (): React.ReactElement => <TableContainer theme={DEFAULT_THEME} />;
export const Flat = (): React.ReactElement => <TableContainer theme={FLAT_THEME_8PX_OLD} />;
export const Old = (): React.ReactElement => <TableContainer theme={DEFAULT_THEME_8PX_OLD} />;
export const Dark = (): React.ReactElement => <TableContainer theme={ThemeFactory.create(reactUiDark)} />;
export const Dark = (): React.ReactElement => <TableContainer theme={DARK_THEME} />;
export const Theme2022 = (): React.ReactElement => <TableContainer theme={THEME_2022} />;
export const Theme2022Dark = (): React.ReactElement => <TableContainer theme={THEME_2022_DARK} />;
18 changes: 4 additions & 14 deletions db-viewer-ui/stories/Themes/ObjectTypes.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
import {
DEFAULT_THEME,
DEFAULT_THEME_8PX_OLD,
FLAT_THEME_8PX_OLD,
ThemeContext,
ThemeFactory,
} from "@skbkontur/react-ui";
import { DEFAULT_THEME, DARK_THEME, THEME_2022, THEME_2022_DARK, ThemeContext } from "@skbkontur/react-ui";
import { Theme } from "@skbkontur/react-ui/lib/theming/Theme";
import React from "react";
import { MemoryRouter, Route, Routes } from "react-router-dom";
import { withRouter } from "storybook-addon-react-router-v6";

import { ObjectTypesContainer } from "../../src/Containers/ObjectTypesContainer";
import { DbViewerApiFake } from "../Api/DbViewerApiFake";

import { reactUiDark } from "./reactUiDark";

export default {
title: "Themes/ObjectTypes",
decorators: [withRouter],
};

const TypesContainer = ({ theme }: { theme: Theme }) => (
Expand All @@ -40,6 +30,6 @@ const TypesContainer = ({ theme }: { theme: Theme }) => (
);

export const Default = (): React.ReactElement => <TypesContainer theme={DEFAULT_THEME} />;
export const Flat = (): React.ReactElement => <TypesContainer theme={FLAT_THEME_8PX_OLD} />;
export const Old = (): React.ReactElement => <TypesContainer theme={DEFAULT_THEME_8PX_OLD} />;
export const Dark = (): React.ReactElement => <TypesContainer theme={ThemeFactory.create(reactUiDark)} />;
export const Dark = (): React.ReactElement => <TypesContainer theme={DARK_THEME} />;
export const Theme2022 = (): React.ReactElement => <TypesContainer theme={THEME_2022} />;
export const Theme2022Dark = (): React.ReactElement => <TypesContainer theme={THEME_2022_DARK} />;
17 changes: 0 additions & 17 deletions db-viewer-ui/stories/Themes/reactUiDark.ts

This file was deleted.

1 change: 0 additions & 1 deletion db-viewer-ui/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"maxNodeModuleJsDepth": 5,
"experimentalDecorators": true,
"noImplicitReturns": true,
"suppressImplicitAnyIndexErrors": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "Node",
Expand Down
Loading
Loading