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

♻️ Chore: Update Database Start page to reflect new theme and utilize batch transactions #76

Merged
merged 36 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
70afd13
Create draft PR for #71
create-issue-branch[bot] May 11, 2024
c1b50c5
Update - New setup page and done page implemented. as well as some Op…
Adammatthiesen May 11, 2024
6b96eb9
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
6e8b93b
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
29eb674
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
c452984
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
0a7f76f
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
c6027ff
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
a4e7536
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
946f672
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
ea0d3d1
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
0d42e22
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
50cdb42
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
57e8047
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
399168e
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
df67135
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
c7b8899
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
f0f76db
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
9e3b172
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
503608a
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
554281e
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
484a3aa
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
3a6b484
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
f62faae
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
bc0cfa1
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
b0d9ef4
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
739b0f7
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
f6f67ed
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
f2f4ebc
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
11fe607
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
bdb9ef7
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
520af67
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
146e972
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 12, 2024
b3ed661
update as per dreyfus's comment
Adammatthiesen May 12, 2024
cb43f60
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 13, 2024
bc1e157
Update packages/studioCMS/src/integrations/studioCMSDashboard/routes/…
Adammatthiesen May 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/studioCMS/src/db/tables.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-expect-error - This is a missing type definition for the `astro:db` import since its a virtual module during Astro Runtime
import { NOW, column, defineTable, sql } from 'astro:db';
import { randomUUID } from 'crypto';
import { randomUUID } from 'node:crypto';

export const Session = defineTable({
columns: {
Expand Down Expand Up @@ -48,6 +48,7 @@ export const Blog = defineTable({
export const Pages = defineTable({
columns: {
id: column.number({ primaryKey: true }),
content: column.text({ multiline: true }),
title: column.text(),
description: column.text(),
publishedAt: column.date({ default: NOW }),
Expand All @@ -56,10 +57,10 @@ export const Pages = defineTable({
default:
'https://images.unsplash.com/photo-1707343843982-f8275f3994c5?q=80&w=1032&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
}),
content: column.text({ multiline: true }),
},
});


export const SiteConfig = defineTable({
columns: {
id: column.number({ primaryKey: true }),
Expand Down
93 changes: 49 additions & 44 deletions packages/studioCMS/src/integrations/studioCMSDashboard/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,18 +200,66 @@ export default defineIntegration({
content: studioCMSDTS.text(),
});

// Add Dashboard Integrations
integrationLogger(logger, verbose, 'info', 'Adding Dashboard Integrations');

// CSS Management
addIntegration(params, {
integration: UnoCSSAstroIntegration({
configFile: false,
injectReset: injectReset,
injectEntry: injectEntry,
presets: [
presetUno(),
presetDaisy({
themes: themes,
darkTheme: darkTheme,
}),
presetWind(),
presetTypography(),
presetIcons({
collections: {
mdi: () => import('@iconify-json/mdi/icons.json').then(i => i.default),
google: FileSystemIconLoader(resolve('./icons/google')),
discord: FileSystemIconLoader(resolve('./icons/discord')),
github: FileSystemIconLoader(resolve('./icons/github')),
auth0: FileSystemIconLoader(resolve('./icons/auth0')),
}
}),
presetScrollbar({
}),
presetWebFonts({
provider: 'google',
fonts: {
// Required Fonts for Google Icons
sans: 'Roboto',
mono: ['Fira Code', 'Fira Mono:400,700'],
},
}),
],
transformers: [
transformerDirectives()
],
}),
});

// In the case of First time Setup run the Start Pages
if ( dbStartPage ) {
injectRoute({
pattern: 'start/',
entrypoint: resolve('./routes/databaseSetup/start.astro'),
entrypoint: resolve('./routes/databaseSetup/main.astro'),
});
injectRoute({
pattern: 'api/setup',
entrypoint: resolve('./routes/databaseSetup/setup.ts'),
});
injectRoute({
pattern: 'done/',
entrypoint: resolve('./routes/databaseSetup/done.astro'),
});
}


// Check if the Dashboard is enabled
if ( dashboardEnabled && !dbStartPage ) {

Expand All @@ -229,49 +277,6 @@ export default defineIntegration({
// Log that the Dashboard is enabled
integrationLogger(logger, verbose, 'info', 'Dashboard is Enabled');

// Add Dashboard Integrations
integrationLogger(logger, verbose, 'info', 'Adding Dashboard Integrations');

// CSS Management
addIntegration(params, {
integration: UnoCSSAstroIntegration({
configFile: false,
injectReset: injectReset,
injectEntry: injectEntry,
presets: [
presetUno(),
presetDaisy({
themes: themes,
darkTheme: darkTheme,
}),
presetWind(),
presetTypography(),
presetIcons({
collections: {
mdi: () => import('@iconify-json/mdi/icons.json').then(i => i.default),
google: FileSystemIconLoader(resolve('./icons/google')),
discord: FileSystemIconLoader(resolve('./icons/discord')),
github: FileSystemIconLoader(resolve('./icons/github')),
auth0: FileSystemIconLoader(resolve('./icons/auth0')),
}
}),
presetScrollbar({
}),
presetWebFonts({
provider: 'google',
fonts: {
// Required Fonts for Google Icons
sans: 'Roboto',
mono: ['Fira Code', 'Fira Mono:400,700'],
},
}),
],
transformers: [
transformerDirectives()
],
}),
});

// Setup the Dashboard Routes
injectRoute({
pattern: makeRoute("/"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ const today = new Date();

<footer class="footer footer-center block mb-5 pt-10">
<div class="pb-2">
&copy; {today.getFullYear()} astrolicious/studiocms - MIT License
<div class="inline">
&copy; {today.getFullYear()} <a href="https://github.com/astrolicious/studiocms" target="_blank"><i>astrolicious/studiocms</i></a> - <a href="https://github.com/astrolicious/studiocms?tab=MIT-1-ov-file#readme" target="_blank" class="font-bold">MIT Licensed</a>
</div>
</div>
<div class="inline opacity-75">
Developed by <a href="https://github.com/astrolicious/studiocms" target="_blank" class="font-bold">The StudioCMS Team</a>
Developed by <a href="https://github.com/astrolicious/studiocms/graphs/contributors" target="_blank" class="font-bold">The StudioCMS Contributors</a>
</div>
</footer>
<style></style>
</footer>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,34 +1,47 @@
---
import { Code } from 'astro:components';
import SetupLayout from './Setup.astro';
import { Layout } from 'studiocms-dashboard:components';
import Config from 'virtual:studiocms/config';

if (Config.includedIntegrations.useInoxSitemap) {
import('sitemap-ext:config').then((sitemap) => {
sitemap.default(false)
})
}
---
<SetupLayout>
<center>
<h1>Setup Done!</h1>
</center>

<p>You can now stop your dev server and add the following option in your astro.config to start using StudioCMS then start back up to see your new CMS data</p>

<Code lang="diff" code={`import { defineConfig } from "astro/config";
const codeBlob = `import { defineConfig } from "astro/config";
import astroStudioCMS from "@astrolicious/studiocms";
import db from '@astrojs/db';

// https://astro.build/config
export default defineConfig({
// other config options,
// other config options,
integrations: [
db(),
astroStudioCMS({
+ dbStartPage: false,
}),
],
});`}/>
});`
---
<Layout title='Setup Done | StudioCMS' description="Welcome to StudioCMS" sideBarActiveItemID='start' includeSidebar={false}>
<div class="container lg:max-w-[50vw]">
<div class="py-8">
<div class="bg-base-300 p-8 md:p-12 lg:p-16 rounded-lg">
<div class="text-5xl font-bold pb-4 text-center">Setup Done!</div>
<div class="py-4">
<text class="text-xl py-2">
<text class="font-bold">Next Step</text>
<br />
You can now stop your dev server and add the following option in your <strong>astro.config</strong> to start using StudioCMS then start back up to see your new CMS data
</text>
</div>


<Code lang="diff" class="p-6" code={codeBlob} wrap/>
</div>
</div>

</div>

</SetupLayout>
</Layout>
Loading
Loading