Skip to content

Commit

Permalink
chore: styling issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Shurtu-gal committed Sep 20, 2024
1 parent 4c17ed0 commit 14a7923
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 16 deletions.
2 changes: 2 additions & 0 deletions apps/studio-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"lint:fix": "next lint --fix",
"cy:e2e:chrome": "cypress run --e2e --browser chrome",
"cy:e2e:chromium": "cypress run --e2e --browser chromium",
"cy:e2e:edge": "cypress run --e2e --browser edge",
Expand All @@ -30,6 +31,7 @@
"@netlify/blobs": "^8.0.1",
"@netlify/functions": "^2.8.1",
"@stoplight/yaml": "^4.3.0",
"@tippyjs/react": "^4.2.6",
"@types/node": "20.4.6",
"@types/react": "18.2.18",
"@types/react-dom": "18.2.7",
Expand Down
14 changes: 7 additions & 7 deletions apps/studio-next/src/netlify/functions/share-retreive.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import { getStore } from "@netlify/blobs";
import type { Config, Context } from "@netlify/functions";
import { getStore } from '@netlify/blobs';
import type { Config, Context } from '@netlify/functions';

export default async (req: Request, context: Context) => {
const share = getStore("share");
const share = getStore('share');
const { shareId } = context.params;

if (!shareId) {
return new Response("Not found", { status: 404 });
return new Response('Not found', { status: 404 });
}

const shareData = await share.get(shareId);

if (!shareData) {
return new Response("Not found", { status: 404 });
return new Response('Not found', { status: 404 });
}

return new Response(shareData, {
headers: {
"content-type": "application/json",
'content-type': 'application/json',
},
});
}

export const config: Config = {
path: "/share/:shareId",
path: '/share/:shareId',
};
14 changes: 7 additions & 7 deletions apps/studio-next/src/netlify/functions/share-store.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import { getStore } from "@netlify/blobs";
import type { Config, Context } from "@netlify/functions";
import { randomUUID } from "crypto";
import { getStore } from '@netlify/blobs';
import type { Config, Context } from '@netlify/functions';
import { randomUUID } from 'crypto';

export default async (req: Request, context: Context) => {
const share = getStore("share");
const share = getStore('share');
const shareId = randomUUID();

const state = await req.json();

await share.set(shareId, JSON.stringify({
URL: context.site.url + "?share=" + shareId,
URL: `${context.site.url }?share=${ shareId}`,
...state,
created: Date.now(),
}))

return new Response(shareId, {
headers: {
"content-type": "text/plain",
'content-type': 'text/plain',
},
});
};

export const config: Config = {
path: "/share",
path: '/share',
}
12 changes: 10 additions & 2 deletions apps/studio-next/src/services/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class ApplicationService extends AbstractService {
const { readOnly, url, base64, share } =
this.svcs.navigationSvc.getUrlParameters();
// readOnly state should be only set to true when someone pass also url or base64 or share parameter
const isStrictReadonly = Boolean(readOnly && (url || base64 || share ));
const isStrictReadonly = Boolean(readOnly && (url || base64 || share));

let error: any;
try {
Expand Down Expand Up @@ -66,11 +66,19 @@ export class ApplicationService extends AbstractService {

const language = this.svcs.formatSvc.retrieveLangauge(content);
const source = url || undefined;
let from = 'url';

if (base64) {
from = 'base64';
} else if (share) {
from = 'share';
}

updateFile('asyncapi', {
content,
language,
source,
from: url ? 'url' : base64 ? 'base64' : 'storage',
from: from as 'url' | 'base64' | 'share',
});
await this.svcs.parserSvc.parse('asyncapi', content, { source });
}
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 14a7923

Please sign in to comment.