Skip to content

Commit

Permalink
fixing issues with stacks
Browse files Browse the repository at this point in the history
  • Loading branch information
SilenNaihin committed Feb 11, 2024
1 parent ef95eed commit 16b5d58
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
22 changes: 22 additions & 0 deletions ui/app/build/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { useEffect, useState } from 'react';

import type { Stack } from './types';

interface WorkflowProps {
slug: string;
}

const Workflow: React.FC<WorkflowProps> = ({ slug }) => {
const [stackInfo, setStackInfo] = useState<Stack | null>(null);
const stackSlug = slug ?? null;

useEffect(() => {
// this should import the jsonl file from ../../stacks/v2/${slug}.jsonl
}, [slug]);

return (
<div>
<h1>Workflow</h1>
</div>
);
};
17 changes: 17 additions & 0 deletions ui/app/build/[slug]/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export interface StackItem {
type: string;
description: string;
variables?: string[];
}

export interface Stack {
created: number;
updated: number;
name: string;
description: string;
trigger: {
type: string;
};
stack: StackItem[];
variables: Record<string, string>;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"created": 1484938100,
"updated": 1484938100,
"name": "Github Commits",
"description": "This recipe summarizes the commits from a Github user in the last month",
"trigger": {
"type": "click"
},
Expand Down
5 changes: 3 additions & 2 deletions ui/app/stacks/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ const Chat = ({ params }: { params: { slug: string } }) => {

const DynamicComponent = useMemo(() => {
if (!stack) return null; // FIXME: redirect or show an error, change DynamicComponent usage below as well
return dynamic(() => import(`@/app/components/stacks/${stack.slug}`), {
return dynamic(() => import(`@/app/components/stacks/v1/${stack.slug}`), {
ssr: false,
loading: () => {
return <div></div>;
return <div>No such stack</div>;
},
});
}, [stack?.slug]);
Expand Down Expand Up @@ -202,6 +202,7 @@ const Container = tw.div`
justify-center
items-center
h-screen
w-full
space-y-6
pb-32
`;
Expand Down

0 comments on commit 16b5d58

Please sign in to comment.