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

chore(T-161): remove react-json-view package #130

Merged
merged 3 commits into from
Nov 14, 2023
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
4 changes: 2 additions & 2 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@basestack/utils": "*",
"material-symbols": "^0.13.0",
"next": "^13.4.19",
"next": "^13.5.4",
"nextra": "2.13.2",
"nextra-theme-docs": "2.13.2",
"react": "^18.2.0",
Expand All @@ -22,7 +22,7 @@
"devDependencies": {
"@basestack/config": "*",
"@basestack/tsconfig": "*",
"@types/node": "20.8.3",
"@types/node": "20.8.6",
"typescript": "^5.2.2"
}
}
48 changes: 27 additions & 21 deletions apps/feature-flags/modals/Flag/Tab/Advance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ import { Text, CalendarInput, Tabs } from "@basestack/design-system";
// Types
import { EnvironmentInput, FlagFormInputs } from "../types";
import { UseFormSetValue } from "react-hook-form";
import type { InteractionProps } from "react-json-view";
import { Value } from "react-calendar/src/shared/types";
// JSON Editor
const ReactJson = dynamic(import("react-json-view"), { ssr: false });
import type { Value } from "react-calendar/src/shared/types";
// Utils
import dayjs from "dayjs";
// Locales
import useTranslation from "next-translate/useTranslation";
// Styles
import { ReactJsonContainer } from "../styles";
import { EditorContainer } from "../styles";

const Editor = dynamic(() => import("@monaco-editor/react"), {
ssr: false,
});

export interface Props {
setValue: UseFormSetValue<FlagFormInputs>;
Expand Down Expand Up @@ -43,7 +44,7 @@ const AdvanceTab = ({ setValue, environments }: Props) => {
[environments, activeTabIndex],
);

const createOnChangeHandler = <T extends Value | InteractionProps>(
const createOnChangeHandler = <T extends Value | string | undefined>(
propName: string,
) => {
return (data: T) => {
Expand All @@ -54,7 +55,7 @@ const AdvanceTab = ({ setValue, environments }: Props) => {
}

if (propName === "payload") {
value = JSON.stringify((data as InteractionProps)?.updated_src ?? "{}");
value = (data as string) ?? "{}";
}

setValue(
Expand All @@ -75,7 +76,7 @@ const AdvanceTab = ({ setValue, environments }: Props) => {
};
};

const onChangeJson = createOnChangeHandler<InteractionProps>("payload");
const onChangeJson = createOnChangeHandler<string | undefined>("payload");
const onChangeDate = createOnChangeHandler<Value>("expiredAt");

return (
Expand Down Expand Up @@ -116,20 +117,25 @@ const AdvanceTab = ({ setValue, environments }: Props) => {
>
{t("flag.tab.advanced.input.payload.title")}
</Text>
<ReactJsonContainer>
<ReactJson
name="data"
theme="chalk"
iconStyle="triangle"
defaultValue="string"
src={JSON.parse(activeTabData?.payload ?? "{}")}
onEdit={onChangeJson}
onAdd={onChangeJson}
onDelete={onChangeJson}
enableClipboard={false}
collapsed={false}
<EditorContainer>
<Editor
height="150px"
theme="vs-dark"
onChange={(value) => onChangeJson(value)}
language="json"
value={activeTabData?.payload ?? "{}"}
options={{
fontSize: "14px",
formatOnPaste: true,
inlineSuggest: false,
formatOnType: true,
autoClosingBrackets: true,
minimap: {
enabled: false,
},
}}
/>
</ReactJsonContainer>
</EditorContainer>
</>
);
};
Expand Down
6 changes: 2 additions & 4 deletions apps/feature-flags/modals/Flag/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ export const Environments = styled.div`
flex-wrap: wrap;
`;

export const ReactJsonContainer = styled.div`
export const EditorContainer = styled.div`
display: flex;
flex-direction: column;

.react-json-view {
font-size: ${rem("14px")};
div {
border-radius: ${rem("4px")};
padding: ${({ theme }) => theme.spacing.s4};
}
`;
35 changes: 18 additions & 17 deletions apps/feature-flags/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@
"@basestack/hooks": "*",
"@basestack/utils": "*",
"@emotion/is-prop-valid": "^1.2.1",
"@floating-ui/react": "^0.26.0",
"@hookform/resolvers": "^3.3.1",
"@floating-ui/react": "^0.26.1",
"@hookform/resolvers": "^3.3.2",
"@monaco-editor/react": "^4.6.0",
"@next-auth/prisma-adapter": "^1.0.4",
"@prisma/client": "^5.4.1",
"@prisma/client": "^5.4.2",
"@tanstack/react-query": "^4.36.1",
"@trpc/client": "^10.40.0",
"@trpc/next": "^10.40.0",
Expand All @@ -46,13 +47,13 @@
"bcryptjs": "^2.4.3",
"cors": "^2.8.5",
"dayjs": "^1.11.10",
"eslint-config-next": "^13.5.2",
"eslint-config-next": "^13.5.4",
"isomorphic-unfetch": "^4.0.2",
"lru-cache": "^10.0.1",
"material-symbols": "^0.13.0",
"next": "^13.4.19",
"next": "^13.5.4",
"next-auth": "^4.23.2",
"next-translate": "^2.6.0",
"next-translate": "^2.6.1",
"polished": "^4.2.2",
"random-word-slugs": "^0.1.7",
"react": "^18.2.0",
Expand All @@ -64,40 +65,40 @@
"react-spring": "^9.7.3",
"react-use": "^17.4.0",
"request-ip": "^3.3.0",
"styled-components": "^6.0.8",
"styled-components": "^6.1.0",
"styled-system": "^5.1.5",
"stylis": "^4.0.0",
"superjson": "^1.13.3",
"superjson": "^2.0.0",
"uuid": "^9.0.1",
"zod": "^3.22.4",
"zustand": "^4.4.3"
},
"devDependencies": {
"@basestack/config": "*",
"@basestack/tsconfig": "*",
"@testing-library/jest-dom": "^6.1.3",
"@testing-library/jest-dom": "^6.1.4",
"@testing-library/react": "^14.0.0",
"@testing-library/react-hooks": "^8.0.1",
"@types/bcryptjs": "^2.4.4",
"@types/cors": "^2.8.14",
"@types/jest": "^29.5.5",
"@types/node": "^20.8.3",
"@types/react": "18.2.25",
"@types/node": "^20.8.6",
"@types/react": "18.2.28",
"@types/react-calendar": "^4.1.0",
"@types/react-dom": "^18.2.11",
"@types/react-dom": "^18.2.13",
"@types/request-ip": "^0.0.39",
"@types/styled-system": "^5.1.18",
"@types/styled-system": "^5.1.19",
"@types/uuid": "^9.0.5",
"eslint": "8.51.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-fetch-mock": "^3.0.3",
"jest-mock-extended": "3.0.5",
"jest-styled-components": "^7.0.8",
"lint-staged": "^14.0.1",
"next-translate-plugin": "^2.6.0",
"jest-styled-components": "^7.2.0",
"lint-staged": "^15.0.1",
"next-translate-plugin": "^2.6.1",
"node-mocks-http": "^1.13.0",
"prisma": "^5.4.1",
"prisma": "^5.4.2",
"turbo": "1.10.15",
"typescript": "^5.2.2"
}
Expand Down
26 changes: 13 additions & 13 deletions apps/landing-page/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
"@basestack/hooks": "*",
"@basestack/utils": "*",
"@emotion/is-prop-valid": "^1.2.1",
"@floating-ui/react": "^0.26.0",
"@hookform/resolvers": "^3.3.1",
"eslint-config-next": "^13.5.2",
"@floating-ui/react": "^0.26.1",
"@hookform/resolvers": "^3.3.2",
"eslint-config-next": "^13.5.4",
"isomorphic-unfetch": "^4.0.2",
"material-symbols": "^0.13.0",
"next": "^13.4.19",
"next": "^13.5.4",
"polished": "^4.2.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand All @@ -35,30 +35,30 @@
"react-spring": "^9.7.3",
"react-syntax-highlighter": "^15.5.0",
"react-use": "^17.4.0",
"styled-components": "^6.0.8",
"styled-components": "^6.1.0",
"styled-system": "^5.1.5",
"stylis": "^4.0.0",
"zod": "^3.22.4"
},
"devDependencies": {
"@basestack/config": "*",
"@basestack/tsconfig": "*",
"@testing-library/jest-dom": "^6.1.3",
"@testing-library/jest-dom": "^6.1.4",
"@testing-library/react": "^14.0.0",
"@testing-library/react-hooks": "^8.0.1",
"@types/jest": "^29.5.5",
"@types/node": "^20.8.3",
"@types/react": "18.2.25",
"@types/react-dom": "^18.2.11",
"@types/react-syntax-highlighter": "^15.5.6",
"@types/styled-system": "^5.1.18",
"@types/node": "^20.8.6",
"@types/react": "18.2.28",
"@types/react-dom": "^18.2.13",
"@types/react-syntax-highlighter": "^15.5.8",
"@types/styled-system": "^5.1.19",
"eslint": "8.51.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-fetch-mock": "^3.0.3",
"jest-mock-extended": "3.0.5",
"jest-styled-components": "^7.0.8",
"lint-staged": "^14.0.1",
"jest-styled-components": "^7.2.0",
"lint-staged": "^15.0.1",
"node-mocks-http": "^1.13.0",
"turbo": "1.10.15",
"typescript": "^5.2.2"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"cz-conventional-changelog": "^3.3.0",
"husky": "^8.0.3",
"is-ci": "^3.0.1",
"lint-staged": "^14.0.1",
"lint-staged": "^15.0.1",
"prettier": "^3.0.3",
"turbo": "1.10.15"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"clean": "rm -rf .turbo && rm -rf node_modules"
},
"dependencies": {
"eslint-config-next": "^13.5.2",
"eslint-config-next": "^13.5.4",
"eslint-config-prettier": "^9.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ exports[`Calendar tests render Calendar correctly 1`] = `
</abbr>
</div>
<div
class="react-calendar__month-view__weekdays__weekday react-calendar__month-view__weekdays__weekday--current react-calendar__month-view__weekdays__weekday--weekend"
class="react-calendar__month-view__weekdays__weekday react-calendar__month-view__weekdays__weekday--weekend"
style="flex-basis: 14.285714285714286%; flex-shrink: 0; flex-grow: 0; overflow: hidden; margin-inline-end: 0;"
>
<abbr
Expand All @@ -405,7 +405,7 @@ exports[`Calendar tests render Calendar correctly 1`] = `
</abbr>
</div>
<div
class="react-calendar__month-view__weekdays__weekday react-calendar__month-view__weekdays__weekday--weekend"
class="react-calendar__month-view__weekdays__weekday react-calendar__month-view__weekdays__weekday--current react-calendar__month-view__weekdays__weekday--weekend"
style="flex-basis: 14.285714285714286%; flex-shrink: 0; flex-grow: 0; overflow: hidden; margin-inline-end: 0;"
>
<abbr
Expand Down Expand Up @@ -553,7 +553,7 @@ exports[`Calendar tests render Calendar correctly 1`] = `
</abbr>
</button>
<button
class="react-calendar__tile react-calendar__tile--now react-calendar__month-view__days__day react-calendar__month-view__days__day--weekend"
class="react-calendar__tile react-calendar__month-view__days__day react-calendar__month-view__days__day--weekend"
style="flex-basis: 14.285714285714286%; flex-shrink: 0; flex-grow: 0; overflow: hidden; margin-inline-end: 0;"
type="button"
>
Expand Down Expand Up @@ -641,7 +641,7 @@ exports[`Calendar tests render Calendar correctly 1`] = `
</abbr>
</button>
<button
class="react-calendar__tile react-calendar__month-view__days__day react-calendar__month-view__days__day--weekend"
class="react-calendar__tile react-calendar__tile--now react-calendar__month-view__days__day react-calendar__month-view__days__day--weekend"
style="flex-basis: 14.285714285714286%; flex-shrink: 0; flex-grow: 0; overflow: hidden; margin-inline-end: 0;"
type="button"
>
Expand Down
8 changes: 4 additions & 4 deletions packages/design-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
"@basestack/hooks": "*",
"@basestack/tsconfig": "*",
"@basestack/utils": "*",
"@testing-library/jest-dom": "^6.1.3",
"@types/react": "18.2.25",
"@types/react-dom": "^18.2.11",
"jest-styled-components": "^7.0.8",
"@testing-library/jest-dom": "^6.1.4",
"@types/react": "18.2.28",
"@types/react-dom": "^18.2.13",
"jest-styled-components": "^7.2.0",
"typescript": "^5.2.2"
},
"peerDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/emails/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
"dependencies": {
"@react-email/components": "0.0.7",
"@react-email/render": "0.0.7",
"nodemailer": "^6.9.1",
"nodemailer": "^6.9.6",
"react-email": "1.9.5"
},
"devDependencies": {
"@basestack/config": "*",
"@basestack/tsconfig": "*",
"@basestack/utils": "*",
"@types/nodemailer": "^6.4.11",
"@types/react": "18.2.25",
"@types/react-dom": "^18.2.11",
"@types/react": "18.2.28",
"@types/react-dom": "^18.2.13",
"raf-stub": "^3.0.0",
"react": "18.2.0",
"tsup": "^7.2.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"@basestack/tsconfig": "*",
"@basestack/utils": "*",
"@testing-library/react-hooks": "^8.0.1",
"@types/react": "18.2.25",
"@types/react-dom": "^18.2.11",
"@types/react": "18.2.28",
"@types/react-dom": "^18.2.13",
"raf-stub": "^3.0.0",
"react": "18.2.0",
"react-test-renderer": "^18.2.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk-flags-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"devDependencies": {
"@basestack/config": "*",
"@basestack/tsconfig": "*",
"@swc/core": "^1.3.92",
"@types/node": "^20.8.3",
"@swc/core": "^1.3.93",
"@types/node": "^20.8.6",
"tsup": "^7.2.0",
"typescript": "^5.2.2"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk-flags-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"devDependencies": {
"@basestack/config": "*",
"@basestack/tsconfig": "*",
"@swc/core": "^1.3.92",
"@types/node": "^20.8.3",
"@swc/core": "^1.3.93",
"@types/node": "^20.8.6",
"tsup": "^7.2.0",
"typescript": "^5.2.2"
},
Expand Down
Loading
Loading