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

Update spaces with themes and documents #25

Closed
wants to merge 1 commit into from
Closed

Conversation

gaelyn
Copy link
Contributor

@gaelyn gaelyn commented Apr 12, 2024

Summary by CodeRabbit

  • New Features
    • Introduced new document and theme configurations to enhance user guidance across different portal interfaces.
    • Added functionality to dynamically apply themes and documents during workspace configuration and space creation.
  • Documentation
    • Added comprehensive guides for data import processes into HCM Show through various document templates.
  • Refactor
    • Enhanced service methods to support new theme and document configurations for improved user experience.

Copy link

coderabbitai bot commented Apr 12, 2024

Walkthrough

The update integrates new themes and documents across various components and services to enhance the user experience in HCM Show. This includes adding theme and document configurations to spaces, and updating the workspace component to utilize these configurations.

Changes

Files Change Summary
.../dynamic-portal/workspace.tsx Updated to use dynamicPortalTheme and dynamicPortalDocument.
app/api/create-space/route.ts Added call to SpaceService.addDocumentAndThemeToSpace.
lib/documents/... Added multiple document definitions for different user guides and data import processes.
lib/services/..., lib/theme-and-document.ts Enhanced SpaceService and FlatfileService with new methods; introduced theme and document interfaces.
lib/themes/... Introduced various theme configurations for different portal interfaces.

Possibly related issues


Recent Review Details

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between c67ca70 and 343c7d6.
Files selected for processing (15)
  • app/(authenticated)/dynamic-portal/workspace.tsx (2 hunks)
  • app/api/create-space/route.ts (1 hunks)
  • lib/documents/documents.ts (1 hunks)
  • lib/documents/dynamic-portal-document.ts (1 hunks)
  • lib/documents/embedded-portal-document.ts (1 hunks)
  • lib/documents/file-feed-document.ts (1 hunks)
  • lib/documents/project-onboarding-document.ts (1 hunks)
  • lib/services/flatfile.ts (2 hunks)
  • lib/services/space.ts (2 hunks)
  • lib/theme-and-document.ts (1 hunks)
  • lib/themes/dynamic-portal-theme.ts (1 hunks)
  • lib/themes/embedded-portal-theme.ts (1 hunks)
  • lib/themes/file-feed-theme.ts (1 hunks)
  • lib/themes/project-onboarding-theme.ts (1 hunks)
  • lib/themes/themes.ts (1 hunks)
Files skipped from review due to trivial changes (4)
  • lib/documents/documents.ts
  • lib/themes/dynamic-portal-theme.ts
  • lib/themes/project-onboarding-theme.ts
  • lib/themes/themes.ts
Additional comments not posted (11)
lib/themes/file-feed-theme.ts (1)

1-68: Ensure consistency in color and style definitions across different themes to maintain a uniform user experience.

Consider reviewing and standardizing color codes and style properties across all theme configurations to ensure a cohesive look and feel throughout the application.

lib/themes/embedded-portal-theme.ts (1)

1-68: Ensure consistency in color and style definitions across different themes to maintain a uniform user experience.

Consider reviewing and standardizing color codes and style properties across all theme configurations to ensure a cohesive look and feel throughout the application.

lib/theme-and-document.ts (1)

1-118: Ensure that all necessary properties are included in the Theme and DocumentConfig interfaces to support the application's requirements.

Review the properties defined in the Theme and DocumentConfig interfaces to ensure they meet all the needs of the application's theming and document requirements. Consider adding or modifying properties if necessary to support all features.

app/(authenticated)/dynamic-portal/workspace.tsx (1)

20-21: Ensure that dynamicPortalTheme and dynamicPortalDocument are correctly applied to the Workspace component.

Also applies to: 96-98

lib/documents/file-feed-document.ts (1)

1-170: Review the use of inline styles in the HTML content for potential security risks and maintainability issues.

Consider using external CSS for styling to enhance maintainability and reduce the risk of security vulnerabilities associated with inline styles. Additionally, ensure that all content is properly sanitized to prevent XSS attacks.

lib/documents/dynamic-portal-document.ts (1)

1-175: Ensure that inline styles are minimized in favor of external stylesheets for maintainability and performance.

Consider extracting the CSS into a separate stylesheet. This will make the document easier to maintain and potentially decrease the size of the HTML document, improving load times.

lib/documents/embedded-portal-document.ts (1)

1-175: Ensure that inline styles are minimized in favor of external stylesheets for maintainability and performance.

Consider extracting the CSS into a separate stylesheet. This will make the document easier to maintain and potentially decrease the size of the HTML document, improving load times.

lib/documents/project-onboarding-document.ts (4)

1-180: Consider separating HTML, CSS, and JavaScript into distinct files for better maintainability.

The current implementation of projectOnboardingDocument embeds HTML, CSS, and potentially JavaScript directly within a TypeScript file. This approach can lead to difficulties in maintaining and scaling the code. Consider separating these concerns into distinct files. For instance, maintain CSS in separate .css files, HTML in .html or template files, and manage dynamic behaviors with JavaScript/TypeScript files. This separation not only enhances maintainability but also improves the clarity and reusability of the code.


3-179: Ensure proper escaping of HTML to prevent XSS vulnerabilities.

The document contains dynamic content and HTML structure defined within a template literal. It's crucial to ensure that any user-generated content or dynamic data incorporated into this HTML is properly escaped to prevent Cross-Site Scripting (XSS) vulnerabilities. Consider using a library or framework that automatically handles HTML escaping to enhance security.


67-106: Review the content for clarity and conciseness in user instructions.

The instructional content within the document is crucial for guiding users effectively. Ensure that the steps are clear, concise, and easy to follow. Consider reviewing the text for any potential improvements in clarity or additional information that might help users better understand the process.


111-146: Validate the accessibility of SVG icons and interactive elements.

The document includes SVG icons and interactive elements. It's important to ensure these elements are accessible to all users, including those with disabilities. This includes proper use of ARIA attributes and ensuring that interactive elements are keyboard navigable. Consider conducting an accessibility audit to identify and rectify any issues.


Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

Comment on lines +5 to +65
<style>
.my-doc {
display: flex;
flex-direction: row;
margin: 24px;
}
.my-doc h1 {
padding: 0px;
margin: 0px;
}
.my-doc h2 {
padding: 0px;
margin: 0px;
}
.my-doc p {
padding: 0px;
margin: 0px;
}
.left {
border-right: 1px solid #17B9A7;
margin-right: 48px;
padding-right: 66px;
width: 70%;
}
.right {
padding-top: 102px;
}
.right > div {
margin-bottom: 32px;
}
.box {
border: 1px solid #17B9A7;
padding: 8px;
margin-bottom: 12px;
border-radius: 8px;
box-shadow: 4px 4px 20px 0px #0000001F;
padding: 24px;
}
.box h2 {
font-size: 16px;
font-weight: 600;
}
.box p {
font-size: 14px;
}
.items > div {
display: flex;
flex-direction: row;
margin-bottom: 12px;
}
.items > div {
display: flex;
flex-direction: row;
align-items: center;
}
.items > div > svg {
width: 24px;
height: 24px;
margin-right: 6px;
}
</style>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor inline CSS to external stylesheets for improved performance and maintainability.

The embedded CSS within the HTML content can lead to slower page load times and makes the document harder to maintain. Moving this CSS to an external stylesheet not only improves the loading time of the document but also allows for better caching strategies and easier maintenance. Here's a suggested refactor:

- <style>
- .my-doc { ... }
- ...
- </style>
+ Link to external stylesheet

And then in a separate CSS file:

.my-doc { ... }
...

Comment on lines +151 to +163
<p style="margin-bottom: 8px;">View the code for this workflow on Github</p>
<a href="https://github.com/FlatFilers/hcm-show-config/blob/main/workflows/project/index.ts" target="_blank" style="display: inline-flex; align-items: center; color: white; text-decoration: none; background-color: #000; padding: 16px 24px;">View on Github
<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg" style="margin-left: 8px;">
<g clip-path="url(#clip0_1519_7607)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.8861 0.423218C5.99451 0.423218 0.42334 6.15238 0.42334 13.2401C0.42334 18.9058 3.99298 23.7016 8.94502 25.399C9.56416 25.5266 9.79094 25.1232 9.79094 24.7839C9.79094 24.4868 9.77053 23.4683 9.77053 22.4071C6.3037 23.1711 5.58176 20.8792 5.58176 20.8792C5.02462 19.3938 4.19911 19.012 4.19911 19.012C3.06441 18.2269 4.28176 18.2269 4.28176 18.2269C5.54043 18.3118 6.20089 19.5425 6.20089 19.5425C7.31492 21.4946 9.11007 20.943 9.83227 20.6034C9.93533 19.7758 10.2657 19.2029 10.6165 18.8847C7.8514 18.5875 4.94222 17.4842 4.94222 12.561C4.94222 11.1605 5.43712 10.0146 6.2213 9.12348C6.09757 8.80525 5.66416 7.48936 6.34528 5.72817C6.34528 5.72817 7.39757 5.38858 9.77028 7.04379C10.7861 6.76323 11.8337 6.62051 12.8861 6.61931C13.9384 6.61931 15.0111 6.76801 16.0017 7.04379C18.3746 5.38858 19.4269 5.72817 19.4269 5.72817C20.108 7.48936 19.6744 8.80525 19.5506 9.12348C20.3555 10.0146 20.83 11.1605 20.83 12.561C20.83 17.4842 17.9208 18.5662 15.1351 18.8847C15.5892 19.2878 15.981 20.0516 15.981 21.2612C15.981 22.98 15.9606 24.3594 15.9606 24.7836C15.9606 25.1232 16.1876 25.5266 16.8065 25.3993C21.7585 23.7013 25.3282 18.9058 25.3282 13.2401C25.3486 6.15238 19.757 0.423218 12.8861 0.423218Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_1519_7607">
<rect width="25" height="25" fill="white" transform="translate(0.42334 0.423218)"/>
</clipPath>
</defs>
</svg>
</a>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure external links have rel="noopener noreferrer" to enhance security.

The anchor tag linking to GitHub should include rel="noopener noreferrer" to prevent potential security vulnerabilities related to opening a new tab. This is a small change that enhances the security of your application:

- <a href="https://github.com/FlatFilers/hcm-show-config/blob/main/workflows/project/index.ts" target="_blank">
+ <a href="https://github.com/FlatFilers/hcm-show-config/blob/main/workflows/project/index.ts" target="_blank" rel="noopener noreferrer">

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
<p style="margin-bottom: 8px;">View the code for this workflow on Github</p>
<a href="https://github.com/FlatFilers/hcm-show-config/blob/main/workflows/project/index.ts" target="_blank" style="display: inline-flex; align-items: center; color: white; text-decoration: none; background-color: #000; padding: 16px 24px;">View on Github
<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg" style="margin-left: 8px;">
<g clip-path="url(#clip0_1519_7607)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.8861 0.423218C5.99451 0.423218 0.42334 6.15238 0.42334 13.2401C0.42334 18.9058 3.99298 23.7016 8.94502 25.399C9.56416 25.5266 9.79094 25.1232 9.79094 24.7839C9.79094 24.4868 9.77053 23.4683 9.77053 22.4071C6.3037 23.1711 5.58176 20.8792 5.58176 20.8792C5.02462 19.3938 4.19911 19.012 4.19911 19.012C3.06441 18.2269 4.28176 18.2269 4.28176 18.2269C5.54043 18.3118 6.20089 19.5425 6.20089 19.5425C7.31492 21.4946 9.11007 20.943 9.83227 20.6034C9.93533 19.7758 10.2657 19.2029 10.6165 18.8847C7.8514 18.5875 4.94222 17.4842 4.94222 12.561C4.94222 11.1605 5.43712 10.0146 6.2213 9.12348C6.09757 8.80525 5.66416 7.48936 6.34528 5.72817C6.34528 5.72817 7.39757 5.38858 9.77028 7.04379C10.7861 6.76323 11.8337 6.62051 12.8861 6.61931C13.9384 6.61931 15.0111 6.76801 16.0017 7.04379C18.3746 5.38858 19.4269 5.72817 19.4269 5.72817C20.108 7.48936 19.6744 8.80525 19.5506 9.12348C20.3555 10.0146 20.83 11.1605 20.83 12.561C20.83 17.4842 17.9208 18.5662 15.1351 18.8847C15.5892 19.2878 15.981 20.0516 15.981 21.2612C15.981 22.98 15.9606 24.3594 15.9606 24.7836C15.9606 25.1232 16.1876 25.5266 16.8065 25.3993C21.7585 23.7013 25.3282 18.9058 25.3282 13.2401C25.3486 6.15238 19.757 0.423218 12.8861 0.423218Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_1519_7607">
<rect width="25" height="25" fill="white" transform="translate(0.42334 0.423218)"/>
</clipPath>
</defs>
</svg>
</a>
<p style="margin-bottom: 8px;">View the code for this workflow on Github</p>
<a href="https://github.com/FlatFilers/hcm-show-config/blob/main/workflows/project/index.ts" target="_blank" rel="noopener noreferrer" style="display: inline-flex; align-items: center; color: white; text-decoration: none; background-color: #000; padding: 16px 24px;">View on Github
<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg" style="margin-left: 8px;">
<g clip-path="url(#clip0_1519_7607)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.8861 0.423218C5.99451 0.423218 0.42334 6.15238 0.42334 13.2401C0.42334 18.9058 3.99298 23.7016 8.94502 25.399C9.56416 25.5266 9.79094 25.1232 9.79094 24.7839C9.79094 24.4868 9.77053 23.4683 9.77053 22.4071C6.3037 23.1711 5.58176 20.8792 5.58176 20.8792C5.02462 19.3938 4.19911 19.012 4.19911 19.012C3.06441 18.2269 4.28176 18.2269 4.28176 18.2269C5.54043 18.3118 6.20089 19.5425 6.20089 19.5425C7.31492 21.4946 9.11007 20.943 9.83227 20.6034C9.93533 19.7758 10.2657 19.2029 10.6165 18.8847C7.8514 18.5875 4.94222 17.4842 4.94222 12.561C4.94222 11.1605 5.43712 10.0146 6.2213 9.12348C6.09757 8.80525 5.66416 7.48936 6.34528 5.72817C6.34528 5.72817 7.39757 5.38858 9.77028 7.04379C10.7861 6.76323 11.8337 6.62051 12.8861 6.61931C13.9384 6.61931 15.0111 6.76801 16.0017 7.04379C18.3746 5.38858 19.4269 5.72817 19.4269 5.72817C20.108 7.48936 19.6744 8.80525 19.5506 9.12348C20.3555 10.0146 20.83 11.1605 20.83 12.561C20.83 17.4842 17.9208 18.5662 15.1351 18.8847C15.5892 19.2878 15.981 20.0516 15.981 21.2612C15.981 22.98 15.9606 24.3594 15.9606 24.7836C15.9606 25.1232 16.1876 25.5266 16.8065 25.3993C21.7585 23.7013 25.3282 18.9058 25.3282 13.2401C25.3486 6.15238 19.757 0.423218 12.8861 0.423218Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_1519_7607">
<rect width="25" height="25" fill="white" transform="translate(0.42334 0.423218)"/>
</clipPath>
</defs>
</svg>
</a>

Comment on lines +38 to +42
await SpaceService.addDocumentAndThemeToSpace({
flatfileSpaceId: space.flatfileSpaceId,
workflowType: space.workflowType,
});

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure error handling for addDocumentAndThemeToSpace to prevent unhandled promise rejections.

-    await SpaceService.addDocumentAndThemeToSpace({
+    try {
+      await SpaceService.addDocumentAndThemeToSpace({
       flatfileSpaceId: space.flatfileSpaceId,
       workflowType: space.workflowType,
     });
+    } catch (error) {
+      console.error('Failed to add document and theme to space', error);
+      return new NextResponse("Error adding document and theme to space", { status: 500 });
+    }

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
await SpaceService.addDocumentAndThemeToSpace({
flatfileSpaceId: space.flatfileSpaceId,
workflowType: space.workflowType,
});
try {
await SpaceService.addDocumentAndThemeToSpace({
flatfileSpaceId: space.flatfileSpaceId,
workflowType: space.workflowType,
});
} catch (error) {
console.error('Failed to add document and theme to space', error);
return new NextResponse("Error adding document and theme to space", { status: 500 });
}

Comment on lines +71 to +103
static async addDocumentAndThemeToSpace({
flatfileSpaceId,
workflowType,
}: {
flatfileSpaceId: string;
workflowType: string;
}) {
const { theme, document } = themeLookup[workflowType];

const workflowDocument = await FlatfileService.createDocument({
flatfileSpaceId,
document,
});

const themeAndDocumentId = {
translationsPath:
"https://raw.githubusercontent.com/FlatFilers/Platform-Translations/main/locales/en/translation.json",
metadata: {
sidebarConfig: {
showSidebar: true,
defaultPage: {
documentId: workflowDocument.data.id,
},
},
theme,
},
};

await FlatfileService.updateSpace({
flatfileSpaceId,
options: themeAndDocumentId,
});
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validate the existence of theme and document in themeLookup before proceeding with operations to prevent runtime errors.

-    const { theme, document } = themeLookup[workflowType];
+    const themeAndDocument = themeLookup[workflowType];
+    if (!themeAndDocument) {
+      throw new Error(`No theme or document found for workflow type: ${workflowType}`);
+    }
+    const { theme, document } = themeAndDocument;

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
static async addDocumentAndThemeToSpace({
flatfileSpaceId,
workflowType,
}: {
flatfileSpaceId: string;
workflowType: string;
}) {
const { theme, document } = themeLookup[workflowType];
const workflowDocument = await FlatfileService.createDocument({
flatfileSpaceId,
document,
});
const themeAndDocumentId = {
translationsPath:
"https://raw.githubusercontent.com/FlatFilers/Platform-Translations/main/locales/en/translation.json",
metadata: {
sidebarConfig: {
showSidebar: true,
defaultPage: {
documentId: workflowDocument.data.id,
},
},
theme,
},
};
await FlatfileService.updateSpace({
flatfileSpaceId,
options: themeAndDocumentId,
});
}
static async addDocumentAndThemeToSpace({
flatfileSpaceId,
workflowType,
}: {
flatfileSpaceId: string;
workflowType: string;
}) {
const themeAndDocument = themeLookup[workflowType];
if (!themeAndDocument) {
throw new Error(`No theme or document found for workflow type: ${workflowType}`);
}
const { theme, document } = themeAndDocument;
const workflowDocument = await FlatfileService.createDocument({
flatfileSpaceId,
document,
});
const themeAndDocumentId = {
translationsPath:
"https://raw.githubusercontent.com/FlatFilers/Platform-Translations/main/locales/en/translation.json",
metadata: {
sidebarConfig: {
showSidebar: true,
defaultPage: {
documentId: workflowDocument.data.id,
},
},
theme,
},
};
await FlatfileService.updateSpace({
flatfileSpaceId,
options: themeAndDocumentId,
});
}

Comment on lines +115 to +134
static async createDocument({
flatfileSpaceId,
document,
}: {
flatfileSpaceId: string;
document: DocumentConfig;
}) {
const spaceId = flatfileSpaceId;
return await api.documents.create(spaceId, document);
}

static async updateSpace({
flatfileSpaceId,
options = {},
}: {
flatfileSpaceId: string;
options: Record<string, any>;
}) {
return await api.spaces.update(flatfileSpaceId, options);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validate inputs and handle API errors in createDocument and updateSpace methods to ensure robustness.

-    return await api.documents.create(spaceId, document);
+    if (!spaceId || !document) {
+      throw new Error('Missing required parameters for creating a document');
+    }
+    try {
+      return await api.documents.create(spaceId, document);
+    } catch (error) {
+      console.error('Failed to create document', error);
+      throw new Error('Error creating document');
+    }

-    return await api.spaces.update(flatfileSpaceId, options);
+    if (!flatfileSpaceId || !options) {
+      throw new Error('Missing required parameters for updating a space');
+    }
+    try {
+      return await api.spaces.update(flatfileSpaceId, options);
+    } catch (error) {
+      console.error('Failed to update space', error);
+      throw new Error('Error updating space');
+    }

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
static async createDocument({
flatfileSpaceId,
document,
}: {
flatfileSpaceId: string;
document: DocumentConfig;
}) {
const spaceId = flatfileSpaceId;
return await api.documents.create(spaceId, document);
}
static async updateSpace({
flatfileSpaceId,
options = {},
}: {
flatfileSpaceId: string;
options: Record<string, any>;
}) {
return await api.spaces.update(flatfileSpaceId, options);
}
static async createDocument({
flatfileSpaceId,
document,
}: {
flatfileSpaceId: string;
document: DocumentConfig;
}) {
const spaceId = flatfileSpaceId;
if (!spaceId || !document) {
throw new Error('Missing required parameters for creating a document');
}
try {
return await api.documents.create(spaceId, document);
} catch (error) {
console.error('Failed to create document', error);
throw new Error('Error creating document');
}
}
static async updateSpace({
flatfileSpaceId,
options = {},
}: {
flatfileSpaceId: string;
options: Record<string, any>;
}) {
if (!flatfileSpaceId || !options) {
throw new Error('Missing required parameters for updating a space');
}
try {
return await api.spaces.update(flatfileSpaceId, options);
} catch (error) {
console.error('Failed to update space', error);
throw new Error('Error updating space');
}
}

@johnmosesman
Copy link
Collaborator

@gaelyn After talking with colin, we only need the dynamic theme here the rest will be config driven

@gaelyn gaelyn closed this Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants