Skip to content

Commit 48b2763

Browse files
authored
Merge pull request #138 from sametcodes/133-previewing-on-private-queries-doesnt-work
fix(#133): Previewing private queries doesnt work
2 parents a5a84b0 + 05acbbd commit 48b2763

File tree

17 files changed

+18087
-2068
lines changed

17 files changed

+18087
-2068
lines changed

.eslintrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
"jsx": true
1919
}
2020
}
21-
}
21+
}

README.md

+14-3
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,22 @@ _All your statistics at once._
88
![](https://readme.rocks/api/view/642dfbff39f5d6e5e5f45c3b)
99
![](https://readme.rocks/api/view?queryConfig%5Busername%5D=sametcodes&id=641b2efa3e90e7e555cdacd7)
1010

11+
## Recent projects and used languages
12+
13+
![](https://readme.rocks/api/view/6431b08616981eaebfd030f9)
14+
![](https://readme.rocks/api/view/6431b559ddde9c1558a16fe6)
15+
1116
## Line stats
1217
![](https://readme.rocks/api/view/642220d0c3f0ffcbcafd573f)
1318

1419
## Your latest `daily.dev` and `dev.to` articles
15-
<img align="left" src="https://readme.rocks/api/view?queryConfig%5Busername%5D=honeypot&queryConfig%5Bcount%5D=3&id=641cd30dbe50187858f7d61a" width="48%" />
16-
<img src="https://readme.rocks/api/view?queryConfig%5Busername%5D=isaacdlyman&queryConfig%5Bcount%5D=2&id=641c6e78c50c62ccdb646278" width="48%" />
17-
<br clear="left"/>
20+
21+
<img src="https://readme.rocks/api/view?queryConfig%5Busername%5D=honeypot&queryConfig%5Bcount%5D=3&id=641cd30dbe50187858f7d61a" />
22+
<img src="https://readme.rocks/api/view?queryConfig%5Busername%5D=isaacdlyman&queryConfig%5Bcount%5D=2&id=641c6e78c50c62ccdb646278" />
23+
24+
## Contributors
25+
26+
<img width="700" src="https://readme.rocks/api/view?queryConfig%5Bowner_name%5D=facebook&queryConfig%5Brepository_name%5D=react&viewConfig%5Btitle%5D=Our%20contributors&viewConfig%5Bsubtitle%5D=Thank%20you%20for%20all%20your%20contributions.%20We%20appreciate%20that.&viewConfig%5Bitems_per_row%5D=15&id=642f70a3104ae4fd80d6efac" />
1827

1928
## Milestones
2029

@@ -26,6 +35,8 @@ _All your statistics at once._
2635
<img src="https://readme.rocks/api/view?queryConfig%5Busername%5D=d-fischer&id=64248c899d4315a82e3cb3f7" />
2736
</a>
2837

38+
<img width="700" src="https://readme.rocks/api/view?queryConfig%5Busername%5D=ljharb&viewConfig%5Btitle%5D=My%20sponsors&viewConfig%5Bsubtitle%5D=Thank%20you%20for%20sponsoring%20me.&viewConfig%5Bitems_per_row%5D=15&id=64300f9e4160c69275201776" />
39+
2940
### Running locally
3041

3142
Make sure you install the dependencies first.

components/form/private.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,10 @@ export default function PrivateConfigForm({
192192
];
193193

194194
const formDataValues = { ...(query || {}), ...(view || {}) };
195-
schema.validateSync(formDataValues, { abortEarly: false });
195+
if (Object.keys(formDataValues).length === 0)
196+
return { queryConfig: query || {}, viewConfig: view || {} };
196197

198+
schema.validateSync(formDataValues, { abortEarly: false });
197199
return {
198200
queryConfig: query || {},
199201
viewConfig: view || {},

components/form/public.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ export default function PublicConfigForm({
8383
];
8484

8585
const formDataValues = { ...(query || {}), ...(view || {}) };
86+
if (Object.keys(formDataValues).length === 0)
87+
return { queryConfig: query || {}, viewConfig: view || {} };
8688
const validations = [queryValidation, viewValidation].filter(Boolean);
8789
const schema = mergeSchemas(...validations);
8890
schema.validateSync(formDataValues, { abortEarly: false });

index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ declare module "next-auth" {
3737

3838
// change unstable_getServerSession returning type
3939
declare module "next-auth/next" {
40-
export function unstable_getServerSession(
40+
export function getServerSession(
4141
...args: Parameters<typeof getServerSession>
4242
): Promise<Session | null>;
4343
}

lib/@dsvgui/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
storybook-static

lib/@dsvgui/.storybook/main.ts

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import path from "path";
2+
3+
/** @type { import('@storybook/nextjs').StorybookConfig } */
4+
const config = {
5+
stories: ["../components/**/*.stories.@(js|jsx|ts|tsx)"],
6+
addons: [
7+
"@storybook/addon-links",
8+
"@storybook/addon-essentials",
9+
"@storybook/addon-interactions",
10+
],
11+
framework: {
12+
name: "@storybook/nextjs",
13+
options: {},
14+
},
15+
docs: {
16+
autodocs: "tag",
17+
},
18+
};
19+
export default config;

lib/@dsvgui/.storybook/preview.ts

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/** @type { import('@storybook/react').Preview } */
2+
const preview = {
3+
parameters: {
4+
actions: { argTypesRegex: "^on[A-Z].*" },
5+
controls: {
6+
matchers: {
7+
color: /(background|color)$/i,
8+
date: /Date$/,
9+
},
10+
},
11+
},
12+
};
13+
14+
export default preview;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type { Meta, StoryObj } from "@storybook/react";
2+
import { Fallback } from "./index";
3+
4+
const meta: Meta<typeof Fallback> = {
5+
title: "Fallback",
6+
component: Fallback,
7+
};
8+
export default meta;
9+
10+
type Story = StoryObj<typeof Fallback>;
11+
12+
export const Warning: Story = {
13+
render: () => (
14+
<Fallback title="Fallback" message="This is a fallback component" />
15+
),
16+
};

lib/@dsvgui/components/fallback/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export const Fallback: React.FC<IFallback> = ({ title, message }) => {
1515
<path
1616
className="icon"
1717
xmlns="http://www.w3.org/2000/svg"
18-
d="M52.95 36.3464C52.3 34.9719 49.9167 34.9719 49.0501 36.3464L29.55 69.7266C29.3564 70.03 29.256 70.3748 29.2591 70.7253C29.2622 71.0758 29.3688 71.4192 29.5678 71.7197C29.7668 72.0203 30.0509 72.2671 30.3907 72.4345C30.7305 72.6019 31.1135 72.6839 31.5 72.6719H70.5001C70.8866 72.6839 71.2696 72.6019 71.6094 72.4345C71.9492 72.2671 72.2333 72.0203 72.4323 71.7197C72.6313 71.4192 72.7379 71.0758 72.741 70.7253C72.7441 70.3748 72.6437 70.03 72.4501 69.7266L52.95 36.3464ZM53.1667 66.7812H48.8334V62.8542H53.1667V66.7812ZM48.8334 58.9271V49.1094H53.1667V58.9271H48.8334Z"
1918
fill="#646464"
19+
d="M52.95 36.3464C52.3 34.9719 49.9167 34.9719 49.0501 36.3464L29.55 69.7266C29.3564 70.03 29.256 70.3748 29.2591 70.7253C29.2622 71.0758 29.3688 71.4192 29.5678 71.7197C29.7668 72.0203 30.0509 72.2671 30.3907 72.4345C30.7305 72.6019 31.1135 72.6839 31.5 72.6719H70.5001C70.8866 72.6839 71.2696 72.6019 71.6094 72.4345C71.9492 72.2671 72.2333 72.0203 72.4323 71.7197C72.6313 71.4192 72.7379 71.0758 72.741 70.7253C72.7441 70.3748 72.6437 70.03 72.4501 69.7266L52.95 36.3464ZM53.1667 66.7812H48.8334V62.8542H53.1667V66.7812ZM48.8334 58.9271V49.1094H53.1667V58.9271H48.8334Z"
2020
/>
2121
<text
2222
fill="#646464"

0 commit comments

Comments
 (0)