Skip to content

Commit

Permalink
Figma Widget (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasfrancisco authored Sep 10, 2024
1 parent 4bf3506 commit 77d4931
Show file tree
Hide file tree
Showing 110 changed files with 2,422 additions and 2,213 deletions.
26 changes: 26 additions & 0 deletions apps/dashboard/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,32 @@ const nextConfig = {
],
},

async headers() {
return [
{
source: '/api/:path*',
headers: [
{
key: 'Access-Control-Allow-Credentials',
value: 'true',
},
{
key: 'Access-Control-Allow-Origin',
value: '*', // TODO: Perhaps set figma origin instead?
},
{
key: 'Access-Control-Allow-Methods',
value: 'POST, PUT, DELETE, OPTIONS',
},
{
key: 'Access-Control-Allow-Headers',
value: 'Content-Type, Authorization',
},
],
},
];
},

async rewrites() {
return [
{
Expand Down
8 changes: 6 additions & 2 deletions packages/api/src/router/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const resourcesRouter = createTRPCRouter({
designTokens: PreprocessedTokensSchema.parse(input.designTokens),
})
.onConflictDoUpdate({
target: Resources.name,
target: [Resources.name, Resources.projectId],
set: {
designTokens: PreprocessedTokensSchema.parse(input.designTokens),
},
Expand All @@ -77,7 +77,11 @@ export const resourcesRouter = createTRPCRouter({

if (!resource) return resource;

await release({ ctx, designTokens: resource.insertedDesignTokens });
try {
await release({ ctx, designTokens: resource.insertedDesignTokens });
} catch (error) {
console.error('💥 error releasing', error);
}

return resource;
}),
Expand Down
1 change: 1 addition & 0 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"@radix-ui/react-navigation-menu": "^1.2.0",
"@radix-ui/react-popover": "^1.1.1",
"@radix-ui/react-select": "^2.1.1",
"@radix-ui/react-separator": "^1.1.0",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-switch": "^1.1.0",
"@radix-ui/react-tabs": "^1.1.0",
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export * from './menubar';
export * from './navigation-menu';
export * from './popover';
export * from './select';
export * from './separator';
export * from './switch';
export * from './tabs';
export * from './text';
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/separator/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './separator';
33 changes: 33 additions & 0 deletions packages/components/src/separator/separator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
'use client';

import * as React from 'react';
import * as SeparatorPrimitive from '@radix-ui/react-separator';

import { cn } from '@/utils';

const Separator = React.forwardRef<
React.ElementRef<typeof SeparatorPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
>(
(
{ className, orientation = 'horizontal', decorative = true, ...props },
ref
) => (
<SeparatorPrimitive.Root
ref={ref}
decorative={decorative}
orientation={orientation}
className={cn(
'ds-shrink-0 ds-bg-border',
orientation === 'horizontal'
? 'ds-h-[1px] ds-w-full'
: 'ds-h-full ds-w-[1px]',
className
)}
{...props}
/>
)
);
Separator.displayName = SeparatorPrimitive.Root.displayName;

export { Separator };
2 changes: 1 addition & 1 deletion packages/components/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ export default defineConfig({
},
target: 'esnext',
sourcemap: true,
emptyOutDir: true,
emptyOutDir: false,
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE "resources" DROP CONSTRAINT "resources_name_unique";--> statement-breakpoint
ALTER TABLE "resources" ADD CONSTRAINT "resources_name_project_id_unique" UNIQUE("name","project_id");
Loading

0 comments on commit 77d4931

Please sign in to comment.