-
Notifications
You must be signed in to change notification settings - Fork 354
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
Supabase SSR #135
Supabase SSR #135
Conversation
…/auth/server-side/sveltekit Supress warnings that are not needed: supabase/auth-js#888 (comment)
WalkthroughThe changes encompass updates to ESLint configurations, GitHub Actions workflows, TypeScript definitions, database migrations, and various Svelte components. Notable modifications include the introduction of email functionality, enhancements to session management, and improvements in user interface components. The project has also seen updates in package dependencies and the addition of automated quality checks, contributing to a more robust and maintainable codebase. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Frontend
participant Backend
participant Database
User->>Frontend: Submit Contact Form
Frontend->>Backend: POST /contact
Backend->>Database: Insert Contact Request
Database-->>Backend: Confirm Insertion
Backend->>Backend: SendAdminEmail
Backend-->>Frontend: Response
Frontend-->>User: Show Success Message
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 18
Outside diff range, codebase verification and nitpick comments (7)
src/routes/(admin)/account/api/+page.server.ts (4)
Line range hint
32-74
: Improve redirection.Use
throw redirect
for immediate redirection.Apply this diff to improve the code:
- if (!session) { - redirect(303, "/login") - } + if (!session) { + throw redirect(303, "/login") + }
Line range hint
76-174
: Improve redirection and error handling.Use
throw redirect
for immediate redirection and log the error for better debugging.Apply this diff to improve the code:
- if (!session) { - redirect(303, "/login") - } + if (!session) { + throw redirect(303, "/login") + } if (error) { + console.error("Failed to update password:", error) return fail(500, { errorMessage: "Unknown error. If this persists please contact us.", newPassword1, newPassword2, currentPassword, }) }
Line range hint
181-220
: Improve redirection and error handling.Use
throw redirect
for immediate redirection and log the error for better debugging.Apply this diff to improve the code:
- if (!session || !user?.id) { - redirect(303, "/login") - } + if (!session || !user?.id) { + throw redirect(303, "/login") + } if (pwError) { + console.error("Failed to delete account:", pwError) redirect(303, "/login/current_password_error") }
Line range hint
223-318
: Improve redirection and error handling.Use
throw redirect
for immediate redirection and log the error for better debugging.Apply this diff to improve the code:
- if (!session || !user?.id) { - redirect(303, "/login") - } + if (!session || !user?.id) { + throw redirect(303, "/login") + } if (error) { + console.error("Failed to update profile:", error) return fail(500, { errorMessage: "Unknown error. If this persists please contact us.", fullName, companyName, website, }) }README.md (3)
Line range hint
22-32
: LGTM! But correct redundant phrases.The main title and feature list improve clarity and organization. However, the phrases "SEO optimization" are redundant.
Apply this diff to correct the redundant phrases:
- Marketing Page with SEO optimization and Sitemap - Blog engine with rich formatting, RSS and SEO optimization. + Marketing Page with SEO and Sitemap + Blog engine with rich formatting, RSS and SEO.
Line range hint
201-238
: LGTM! But correct flagged issues.The setup Supabase project section provides detailed and clear instructions for setting up a Supabase project. However, there are several flagged issues.
Apply this diff to correct the issues:
- Set up your database schema: + Set up your database schema: - For new Supabase projects: + For new Supabase projects: - For existing projects: + For existing projects: - For local development: create a `.env.local` file: + For local development, create a `.env.local` file: - For production, add these two keys to your deployment environment (see below). We suggest you encrypt your service role. + For production, add these two keys to your deployment environment (see below). We suggest you encrypt your service role. - Auth Callback + Auth Callback - Set your default callback URL for auth in the Supabase Auth console. For example, for the demo page we added: `https://saasstarter.work/auth/callback` . Also add that same URL to the the “allowed redirect URL” list in the Supabase auth console further down the page. + Set your default callback URL for auth in the Supabase Auth console. For example, for the demo page, we added: `https://saasstarter.work/auth/callback`. Also add that same URL to the “allowed redirect URL” list in the Supabase auth console further down the page. - Add a link to the redirect URL allow list which allows parameters to your auth callback. For example we added the following for the demo page: `https://saasstarter.work/auth/callback?*` + Add a link to the redirect URL allow list which allows parameters to your auth callback. For example, we added the following for the demo page: `https://saasstarter.work/auth/callback?*` - Test that the "sign up" and "forgot password" emails link back to your domain correctly by checking the have a redirect_to parameter to your `yourdomain.com/auth/callback`. If they link to the base URL or another page, double check you have the config above set correctly. + Test that the "sign up" and "forgot password" emails link back to your domain correctly by checking they have a redirect_to parameter to your `yourdomain.com/auth/callback`. If they link to the base URL or another page, double-check you have the config above set correctly. - OAuth Logins + OAuth Logins - Decide which oauth logins you want to support, and set them up in the Supabase Auth console under “Auth Providers”. Be sure to provide them the Supabase callback URL. Also be sure to set any platform specific permissions/settings to retrieve their email as part of the login (for example, for Github it's under `Account Permissions > Email Address > Read Only Access` + Decide which OAuth logins you want to support, and set them up in the Supabase Auth console under “Auth Providers”. Be sure to provide them the Supabase callback URL. Also be sure to set any platform-specific permissions/settings to retrieve their email as part of the login (for example, for Github it's under `Account Permissions > Email Address > Read Only Access`Tools
LanguageTool
[uncategorized] ~225-~225: Possible missing comma found.
Context: ...Auth console. For example, for the demo page we added: `https://saasstarter.work/aut...(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~225-~225: “to the” seems less likely than “to”.
Context: ...auth/callback` . Also add that same URL to the the “allowed redirect URL” list in the ...(AI_HYDRA_LEO_CP_TO_THE_TO)
[typographical] ~226-~226: After the expression ‘for example’ a comma is usually used.
Context: ...s parameters to your auth callback. For example we added the following for the demo pag...(COMMA_FOR_EXAMPLE)
[grammar] ~228-~228: Did you mean “they”?
Context: ...ck to your domain correctly by checking the have a redirect_to parameter to your `y...(THE_THEY)
[uncategorized] ~230-~230: When ‘platform-specific’ is used as a modifier, it is usually spelled with a hyphen.
Context: ...e callback URL. Also be sure to set any platform specific permissions/settings to retrieve their ...(SPECIFIC_HYPHEN)
Line range hint
261-291
: LGTM! But correct flagged issues.The deploy section provides clear instructions for deploying the project. However, there are several flagged issues.
Apply this diff to correct the issues:
- Deploy to Vercel + Deploy to Vercel - Deploy using Vercel's deploy button: + Deploy using Vercel's deployment button: - Here is a demo of of Saas Starter hosted on Vercel: [vercel.saasstarter.work](https://vercel.saasstarter.work) + Here is a demo of Saas Starter hosted on Vercel: [vercel.saasstarter.work](https://vercel.saasstarter.work) - Deploy Alternatives + Deploy Alternatives - If you prefer another host you can explore alternatives: + If you prefer another host, you can explore alternatives:Tools
LanguageTool
[grammar] ~278-~278: The word ‘deploy’ is a verb. Did you mean the noun “deployment” (= release, placement)?
Context: ...Deploy to Vercel Deploy using Vercel's deploy button: [![Deploy with Vercel](https:/...(PREPOSITION_VERB)
[duplication] ~282-~282: Possible typo: you repeated a word
Context: ...XjAs5Di2-8221K-N0YttbE) Here is a demo of of Saas Starter hosted on Vercel: [vercel....(ENGLISH_WORD_REPEAT_RULE)
[uncategorized] ~286-~286: Possible missing comma found.
Context: ...loy Alternatives If you prefer another host you can explore alternatives: - [Svelt...(AI_HYDRA_LEO_MISSING_COMMA)
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
package-lock.json
is excluded by!**/package-lock.json
Files selected for processing (56)
- .eslintrc.cjs (1 hunks)
- .github/workflows/format.yml (1 hunks)
- .prettierignore (1 hunks)
- .vscode/settings.json (1 hunks)
- README.md (9 hunks)
- checks.sh (1 hunks)
- database_migration.sql (2 hunks)
- email_docs.md (1 hunks)
- local_env_template (1 hunks)
- package.json (1 hunks)
- src/DatabaseDefinitions.ts (4 hunks)
- src/app.d.ts (2 hunks)
- src/config.ts (1 hunks)
- src/hooks.server.ts (2 hunks)
- src/lib/build_index.ts (1 hunks)
- src/lib/emails/welcome_email_html.svelte (1 hunks)
- src/lib/emails/welcome_email_text.svelte (1 hunks)
- src/lib/mailer.test.ts (1 hunks)
- src/lib/mailer.ts (1 hunks)
- src/routes/(admin)/account/(menu)/+layout.svelte (3 hunks)
- src/routes/(admin)/account/(menu)/+page.server.ts (1 hunks)
- src/routes/(admin)/account/(menu)/billing/+page.server.ts (2 hunks)
- src/routes/(admin)/account/(menu)/billing/+page.svelte (1 hunks)
- src/routes/(admin)/account/(menu)/billing/manage/+page.server.ts (2 hunks)
- src/routes/(admin)/account/(menu)/settings/+page.svelte (3 hunks)
- src/routes/(admin)/account/(menu)/settings/change_email/+page.svelte (2 hunks)
- src/routes/(admin)/account/(menu)/settings/change_email_subscription/+page.svelte (1 hunks)
- src/routes/(admin)/account/(menu)/settings/change_password/+page.svelte (2 hunks)
- src/routes/(admin)/account/(menu)/settings/settings_module.svelte (4 hunks)
- src/routes/(admin)/account/+layout.server.ts (1 hunks)
- src/routes/(admin)/account/+layout.ts (1 hunks)
- src/routes/(admin)/account/api/+page.server.ts (10 hunks)
- src/routes/(admin)/account/api/page.server.test.ts (1 hunks)
- src/routes/(admin)/account/create_profile/+page.svelte (2 hunks)
- src/routes/(admin)/account/create_profile/+page.ts (1 hunks)
- src/routes/(admin)/account/subscribe/[slug]/+page.server.ts (3 hunks)
- src/routes/(admin)/account/subscription_helpers.server.ts (4 hunks)
- src/routes/(marketing)/+layout.svelte (3 hunks)
- src/routes/(marketing)/+page.svelte (5 hunks)
- src/routes/(marketing)/auth/callback/+server.js (2 hunks)
- src/routes/(marketing)/blog/(posts)/+layout.svelte (2 hunks)
- src/routes/(marketing)/contact_us/+page.server.ts (2 hunks)
- src/routes/(marketing)/login/+layout.server.ts (1 hunks)
- src/routes/(marketing)/login/+layout.ts (1 hunks)
- src/routes/(marketing)/login/sign_in/+page.svelte (1 hunks)
- src/routes/(marketing)/pricing/pricing_plans.ts (1 hunks)
- src/routes/(marketing)/search/+page.server.ts (1 hunks)
- src/routes/(marketing)/search/+page.svelte (1 hunks)
- src/routes/(marketing)/search/api.json/+server.ts (1 hunks)
- src/routes/(marketing)/sitemap.xml/+server.ts (1 hunks)
- src/routes/+error.svelte (1 hunks)
- supabase/migrations/20240730010101_initial.sql (1 hunks)
- supabase/migrations/20240731051052_add_unsubscribed_to_profiles.sql (1 hunks)
- svelte.config.js (1 hunks)
- tsconfig.json (1 hunks)
- vite.config.ts (1 hunks)
Files skipped from review due to trivial changes (6)
- .prettierignore
- src/routes/(admin)/account/(menu)/billing/+page.svelte
- src/routes/(marketing)/login/sign_in/+page.svelte
- src/routes/(marketing)/pricing/pricing_plans.ts
- src/routes/(marketing)/search/+page.server.ts
- src/routes/+error.svelte
Additional context used
Shellcheck
checks.sh
[warning] 6-6: In POSIX sh, &> is undefined.
(SC3020)
LanguageTool
email_docs.md
[uncategorized] ~17-~17: Loose punctuation mark.
Context: .... See below. -PRIVATE_RESEND_API_KEY
: a https://resend.com API key. Note, you...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~18-~18: Loose punctuation mark.
Context: ...e their service. -PRIVATE_ADMIN_EMAIL
: the email address to which admin emails...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~19-~19: Loose punctuation mark.
Context: ... be sent. -PRIVATE_FROM_ADMIN_EMAIL
: the email address to use as the from ad...(UNLIKELY_OPENING_PUNCTUATION)
README.md
[style] ~64-~64: This phrase is redundant (‘O’ stands for ‘optimization’). Use simply “SEO”.
Context: ...r European users. - Marketing Page with SEO optimization and Sitemap - Blog engine with rich for...(ACRONYM_TAUTOLOGY)
[style] ~65-~65: This phrase is redundant (‘O’ stands for ‘optimization’). Use simply “SEO”.
Context: ...og engine with rich formatting, RSS and SEO optimization. - User Dashboard with user profile, us...(ACRONYM_TAUTOLOGY)
[uncategorized] ~143-~143: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...sing CMSaasStarter as a starter template and you aren't planning on contributing wor...(COMMA_COMPOUND_SENTENCE)
[uncategorized] ~143-~143: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...on contributing work back to the public open source project. See [Github Docs](https://docs...(EN_COMPOUND_ADJECTIVE_INTERNAL)
[grammar] ~144-~144: The verb “contribute” needs to be in the to-infinitive form.
Context: ...late). - "Fork": use this button if you want contribute some or all of your work back to the pu...(MISSING_TO_BEFORE_A_VERB)
[uncategorized] ~144-~144: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ... or all of your work back to the public open source project. It will keep the full commit h...(EN_COMPOUND_ADJECTIVE_INTERNAL)
[uncategorized] ~172-~172: Possible missing comma found.
Context: ...ools Locally To manually run all these tools run the following script. You can view ...(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~225-~225: Possible missing comma found.
Context: ...Auth console. For example, for the demo page we added: `https://saasstarter.work/aut...(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~225-~225: “to the” seems less likely than “to”.
Context: ...auth/callback` . Also add that same URL to the the “allowed redirect URL” list in the ...(AI_HYDRA_LEO_CP_TO_THE_TO)
[typographical] ~226-~226: After the expression ‘for example’ a comma is usually used.
Context: ...s parameters to your auth callback. For example we added the following for the demo pag...(COMMA_FOR_EXAMPLE)
[grammar] ~228-~228: Did you mean “they”?
Context: ...ck to your domain correctly by checking the have a redirect_to parameter to your `y...(THE_THEY)
[uncategorized] ~230-~230: When ‘platform-specific’ is used as a modifier, it is usually spelled with a hyphen.
Context: ...e callback URL. Also be sure to set any platform specific permissions/settings to retrieve their ...(SPECIFIC_HYPHEN)
[grammar] ~278-~278: The word ‘deploy’ is a verb. Did you mean the noun “deployment” (= release, placement)?
Context: ...Deploy to Vercel Deploy using Vercel's deploy button: [![Deploy with Vercel](https:/...(PREPOSITION_VERB)
[duplication] ~282-~282: Possible typo: you repeated a word
Context: ...XjAs5Di2-8221K-N0YttbE) Here is a demo of of Saas Starter hosted on Vercel: [vercel....(ENGLISH_WORD_REPEAT_RULE)
[uncategorized] ~286-~286: Possible missing comma found.
Context: ...loy Alternatives If you prefer another host you can explore alternatives: - [Svelt...(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~327-~327: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ... product. ## Community Extensions The open source community is extending and improving Sa...(EN_COMPOUND_ADJECTIVE_INTERNAL)
[typographical] ~329-~329: Consider adding a comma here.
Context: ...plify maintenance. However, if you need them you can cherry pick into your fork/repo...(IF_COMMA)
[misspelling] ~329-~329: This word is normally spelled with a hyphen.
Context: ...ance. However, if you need them you can cherry pick into your fork/repo: - Internationaliz...(EN_COMPOUNDS_CHERRY_PICK)
Markdownlint
email_docs.md
17-17: null
Bare URL used(MD034, no-bare-urls)
README.md
150-150: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
174-174: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
191-191: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
Additional comments not posted (150)
supabase/migrations/20240731051052_add_unsubscribed_to_profiles.sql (1)
1-2
: LGTM!The SQL statement correctly adds a new column
unsubscribed
to theprofiles
table with a default value offalse
.src/routes/(admin)/account/(menu)/+page.server.ts (1)
8-8
: LGTM! But verify the impact on control flow.The function correctly signs out a user and redirects them to the home page. However, ensure that the change in the redirect handling does not affect the control flow and response handling.
Run the following script to verify the impact on control flow:
Verification successful
Redirect Handling in
signout
Function is AppropriateThe
redirect
function from@sveltejs/kit
is designed to handle HTTP redirects properly. The change from throwing the redirect to calling it directly in thesignout
function is consistent with its intended use and should not negatively impact the control flow.
src/routes/(admin)/account/(menu)/+page.server.ts
src/routes/(admin)/account/api/+page.server.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of the change in redirect handling on control flow. # Test: Search for the function usage. Expect: No issues with the control flow. rg --type ts -A 5 $'signout'Length of output: 1015
Script:
#!/bin/bash # Search for the implementation or usage of the `redirect` function to understand its behavior. rg --type ts -A 5 'function redirect'Length of output: 39
Script:
#!/bin/bash # Search for import statements related to `redirect` in the files where `signout` is defined. rg --type ts 'import.*redirect' src/routes/(admin)/account/(menu)/+page.server.ts src/routes/(admin)/account/api/+page.server.tsLength of output: 265
Script:
#!/bin/bash # Correct the file paths and search for import statements related to `redirect`. rg --type ts 'import.*redirect' | grep -E 'src/routes/\(admin\)/account/\(menu\)/\+page\.server\.ts|src/routes/\(admin\)/account/api/\+page\.server\.ts'Length of output: 339
src/config.ts (1)
5-5
: LGTM!The new constant
CreateProfileStep
is correctly defined and follows best practices for adding new configuration options.src/routes/(admin)/account/create_profile/+page.ts (1)
9-9
: Verify the new redirection approach.The function now uses the
redirect
function directly instead of throwing it. Ensure that this approach is consistent with the framework's best practices and does not affect the control flow or response handling.Check the framework documentation or examples to confirm the correct usage of the
redirect
function..vscode/settings.json (4)
3-5
: LGTM!The setting for the Svelte formatter is correctly configured.
6-8
: LGTM!The setting for the TypeScript formatter is correctly configured.
9-11
: LGTM!The setting for the JavaScript formatter is correctly configured.
12-12
: LGTM!The ESLint validation settings are correctly configured to include TypeScript.
local_env_template (3)
1-4
: LGTM!The Supabase settings are correctly configured.
6-6
: LGTM!The Stripe settings are correctly configured.
9-12
: LGTM!The email settings are correctly configured.
src/routes/(marketing)/sitemap.xml/+server.ts (3)
1-3
: LGTM!The import statements are correct and necessary for the functionality of the file.
5-5
: LGTM!The
prerender
export is correct and necessary for pre-rendering the sitemap.
7-14
: LGTM!The
GET
function is correctly implemented and generates a sitemap response with the specified configurations.src/routes/(marketing)/login/+layout.server.ts (2)
Line range hint
1-2
: LGTM!The import statements are correct and necessary for the functionality of the file.
4-19
: LGTM!The
load
function is correctly implemented and handles user redirection and cookies appropriately.src/routes/(admin)/account/+layout.server.ts (2)
Line range hint
1-2
: LGTM!The import statements are correct and necessary for the functionality of the file.
6-20
: LGTM!The
load
function is correctly implemented and handles user redirection, session validation, and cookies appropriately.src/routes/(marketing)/search/api.json/+server.ts (1)
4-14
: Improve error handling and response.The function can be improved by:
- Adding error handling for the import and build process.
- Using
throw error
instead oferror
for the 404 response.Apply this diff to improve the function:
export async function GET() { // only build search index in dev mode. It will be pre-built in production (see vite.config.js) if (dev) { try { const { buildSearchIndex } = await import("$lib/build_index") const searchData = await buildSearchIndex() return new Response(JSON.stringify(searchData), { headers: { "Content-Type": "application/json" }, }) } catch (err) { throw error(500, "Failed to build search index") } } throw error(404, "Search index not found") }svelte.config.js (1)
2-2
: LGTM!The change in the import statement reflects an update in the module structure of the Svelte framework.
The code changes are approved.
src/app.d.ts (1)
1-1
: LGTM!The changes enhance the functionality of session handling by providing more detailed session information.
The code changes are approved.
Also applies to: 11-15
src/lib/emails/welcome_email_text.svelte (1)
14-18
: LGTM!The code changes are approved.
vite.config.ts (1)
22-22
: LGTM!The code changes are approved.
tsconfig.json (1)
12-13
: LGTM!The addition of
"types": ["vitest/globals"]
is beneficial for streamlining the testing process in a TypeScript environment..github/workflows/format.yml (3)
18-18
: LGTM!The addition of the step to set up the Go environment using
actions/setup-go@v5
is beneficial for projects that require Go tools.
26-28
: LGTM!The addition of the step to download the
misspell
utility usinggo install github.com/client9/misspell/cmd/misspell@latest
is beneficial for integrating spelling checks into the automated workflow.
29-30
: LGTM!The addition of the step to run
misspell -error ./src README.md
is beneficial for ensuring that any misspelled words are flagged as errors during the CI process.src/routes/(marketing)/login/+layout.ts (5)
5-9
: LGTM!The imports of
createBrowserClient
,createServerClient
, andisBrowser
from@supabase/ssr
are necessary for the conditional logic that checks the execution environment.
14-15
: LGTM!The conditional logic using
isBrowser()
to determine the execution environment is correctly implemented.
15-19
: LGTM!The creation of the Supabase client for the browser environment using
createBrowserClient
with the necessary parameters is correctly implemented.
20-29
: LGTM!The creation of the Supabase client for the server environment using
createServerClient
with the necessary parameters, including handling cookies, is correctly implemented.
Line range hint
31-33
: LGTM!The return statement correctly returns the Supabase client and the URL.
src/routes/(admin)/account/(menu)/settings/change_email_subscription/+page.svelte (2)
8-10
: LGTM!The code changes are approved.
14-26
: LGTM!The code changes are approved.
checks.sh (1)
18-31
: LGTM!The code changes are approved.
src/routes/(admin)/account/(menu)/settings/change_email/+page.svelte (2)
Line range hint
13-15
: LGTM!The code changes are approved.
Line range hint
18-33
: LGTM!The code changes are approved.
src/routes/(admin)/account/(menu)/billing/+page.server.ts (5)
1-4
: LGTM!The import statements are correct and necessary for the functionality.
6-7
: LGTM!The function signature and the retrieval of
safeGetSession
andsupabaseServiceRole
are correct.
11-13
: LGTM!The session and user data handling is correct and enhances security by ensuring both session and user ID are validated.
18-21
: Verify the impact of not throwing the error.The customer ID retrieval and error handling are correct, but the use of
error(500, {...})
without throwing might affect error propagation.Ensure that the error handling behavior is as expected and does not lead to unintended consequences.
34-36
: Verify the impact of not throwing the error.The subscription fetching and error handling are correct, but the use of
error(500, {...})
without throwing might affect error propagation.Ensure that the error handling behavior is as expected and does not lead to unintended consequences.
src/routes/(admin)/account/(menu)/billing/manage/+page.server.ts (5)
1-5
: LGTM!The import statements are correct and necessary for the functionality.
6-7
: LGTM!The function signature and the retrieval of
url
,safeGetSession
, andsupabaseServiceRole
are correct.
12-14
: LGTM!The session and user data handling is correct and enhances security by ensuring both session and user ID are validated.
19-22
: Verify the impact of not throwing the error.The customer ID retrieval and error handling are correct, but the use of
error(500, {...})
without throwing might affect error propagation.Ensure that the error handling behavior is as expected and does not lead to unintended consequences.
35-38
: Verify the impact of not throwing the error.The Stripe portal session creation and redirection are correct, but the use of
error(500, {...})
without throwing might affect error propagation.Ensure that the error handling behavior is as expected and does not lead to unintended consequences.
.eslintrc.cjs (1)
29-35
: LGTM!The new configuration block is correct and allows for more flexibility in testing by permitting the use of the
any
type.package.json (12)
21-21
: LGTM!The update from
^0.5.10
to^0.5.13
is a minor version update and is unlikely to introduce breaking changes.
22-22
: LGTM!The addition of
@types/glob
with version^8.1.0
provides type definitions for theglob
package, which is beneficial for TypeScript projects.
23-23
: LGTM!The addition of
@types/html-to-text
with version^9.0.4
provides type definitions for thehtml-to-text
package, which is beneficial for TypeScript projects.
24-24
: LGTM!The addition of
@types/jsdom
with version^21.1.7
provides type definitions for thejsdom
package, which is beneficial for TypeScript projects.
32-32
: LGTM!The addition of
fuse.js
with version^7.0.0
provides a powerful library for fuzzy searching, which can enhance the search functionality in the project.
33-33
: LGTM!The addition of
html-to-text
with version^9.0.5
provides a library for converting HTML content to plain text, which can be useful for email processing or text extraction.
34-34
: LGTM!The addition of
jsdom
with version^24.1.1
provides a library for simulating a browser environment in Node.js, which can be useful for testing and server-side rendering.
38-38
: LGTM!The addition of
super-sitemap
with version^0.15.1
provides a library for generating sitemaps, which can enhance the SEO capabilities of the project.
43-43
: Verify compatibility withvite
version^5.0.0
.The update from
^4.4.2
to^5.0.0
may introduce breaking changes or new features. Ensure compatibility with the rest of the codebase.Run the following script to check for compatibility issues:
19-19
: Verify compatibility with@sveltejs/kit
version^2.0.0
.The update from
^1.30.4
to^2.0.0
may introduce breaking changes or new features. Ensure compatibility with the rest of the codebase.Run the following script to check for compatibility issues:
18-18
: Verify compatibility with@sveltejs/adapter-auto
version^3.2.0
.The update from
^2.0.0
to^3.2.0
may introduce breaking changes or new features. Ensure compatibility with the rest of the codebase.Run the following script to check for compatibility issues:
44-44
: Verify compatibility withvitest
version^1.0.0
.The update from
^0.34.0
to^1.0.0
may introduce breaking changes or new features. Ensure compatibility with the rest of the codebase.Run the following script to check for compatibility issues:
src/routes/(admin)/account/subscribe/[slug]/+page.server.ts (2)
1-2
: LGTM!The imports are necessary for the functionality of the
load
function.
Line range hint
16-63
: LGTM!The changes enhance the clarity of the code by reducing the number of throw statements and improving the handling of user data.
src/routes/(admin)/account/(menu)/settings/+page.svelte (3)
10-10
: LGTM!The changes are necessary for the functionality of the component.
42-42
: LGTM!The changes enhance the component's functionality by providing a dedicated section for managing email subscriptions while altering the data structure used for user information.
55-66
: LGTM!The addition of the
SettingsModule
for email subscription settings enhances the component's functionality.src/routes/(marketing)/contact_us/+page.server.ts (1)
2-2
: LGTM!The import statement for
sendAdminEmail
is correct and necessary for the new functionality.src/routes/(marketing)/blog/(posts)/+layout.svelte (1)
22-29
: LGTM!The
buildLdJson
function is correctly implemented and improves code clarity.src/lib/build_index.ts (2)
1-6
: LGTM!The import statements are correct and necessary for the new functionality.
63-77
: LGTM!The
buildAndCacheSearchIndex
function is correctly implemented and follows best practices for file system operations.database_migration.sql (1)
8-9
: LGTM!The addition of the
unsubscribed
column with a default value offalse
is correct and does not introduce any issues.src/routes/(admin)/account/+layout.ts (5)
5-9
: LGTM!The import statements for
createBrowserClient
,createServerClient
, andisBrowser
from@supabase/ssr
are correct and necessary for the new implementation.
17-32
: LGTM!The conditional instantiation of the Supabase client based on the browser/server context is correct and enhances the handling of cookies in the server context.
34-52
: LGTM!The session retrieval logic using
supabase.auth.getSession()
is correct, and the warning suppression logic is necessary due to changes in the Supabase API.
53-58
: LGTM!The user retrieval logic using
supabase.auth.getUser()
and the MFA level retrieval logic usingsupabase.auth.mfa.getAuthenticatorAssuranceLevel()
are correct and necessary for the new implementation.
74-80
: LGTM!The return statement of the
load
function is correct and includes all necessary data for the new implementation.supabase/migrations/20240730010101_initial.sql (6)
2-9
: LGTM!The creation of the
profiles
table is correct and includes all necessary columns.
10-22
: LGTM!The Row Level Security (RLS) setup and policies for the
profiles
table are correct and necessary for security.
24-32
: LGTM!The creation of the
stripe_customers
table is correct and includes all necessary columns. The RLS setup is also correct.
34-46
: LGTM!The creation of the
contact_requests
table is correct and includes all necessary columns. The RLS setup is also correct.
48-60
: LGTM!The trigger and function for automatically creating a profile entry when a new user signs up via Supabase Auth are correctly implemented and necessary.
62-72
: LGTM!The storage setup and access controls for avatar images are correctly implemented and necessary.
src/hooks.server.ts (6)
7-7
: LGTM!The import statement for
createSupabaseServerClient
has been correctly replaced withcreateServerClient
from the@supabase/ssr
package.
12-29
: LGTM!The Supabase client is created using
createServerClient
, and the cookie handling logic has been updated to includegetAll
andsetAll
operations, ensuring that the path for cookies is set to/
to maintain previous behavior.
30-34
: LGTM!The Supabase service role client is created using
createClient
, which is consistent with the rest of the code.
38-46
: LGTM!The code correctly handles the suppression of the getSession warning if
suppressGetSessionWarning
is present inevent.locals.supabase.auth
.
Line range hint
47-76
: LGTM!The
safeGetSession
function has been updated to include an additional return value,amr
, which represents the Authenticator Assurance Level. The changes enhance the response structure when no session is found and improve error handling for user retrieval.
81-81
: LGTM!The filter for serialized response headers has been expanded to include
x-supabase-api-version
, which is consistent with the rest of the code.src/DatabaseDefinitions.ts (2)
53-53
: LGTM!The addition of the
unsubscribed
property to theRow
,Insert
, andUpdate
sub-interfaces within theDatabase
interface is consistent and enhances the data structure to accommodate a new state related to user subscriptions.Also applies to: 62-62, 71-71
82-106
: LGTM!The addition of the
stripe_customers
section to theDatabase
interface expands the functionality, allowing for more comprehensive data management related to Stripe customer records.src/routes/(admin)/account/(menu)/settings/change_password/+page.svelte (4)
11-11
: LGTM!The renaming of
session
touser
improves clarity by directly referencing the user object.
17-18
: LGTM!The change correctly updates the reference from
session
touser
.
22-22
: LGTM!The change correctly updates the reference from
session
touser
.
29-29
: LGTM!The changes correctly update the references from
session
touser
.Also applies to: 92-93
src/routes/(admin)/account/create_profile/+page.svelte (2)
2-4
: LGTM!The change does not affect functionality but improves the organization of the code.
9-9
: LGTM!The changes correctly update the references from
session
touser
.Also applies to: 114-114
src/routes/(admin)/account/subscription_helpers.server.ts (5)
1-1
: LGTM!The change correctly imports the
User
type.
6-6
: LGTM!The change correctly imports the
pricingPlans
module.
11-11
: LGTM!The changes correctly update the parameter name and type.
Also applies to: 14-14
19-19
: LGTM!The changes correctly update the references from
session
touser
.Also applies to: 35-35, 45-45, 48-48
65-65
: LGTM!The change correctly updates the reference from
session
touser
.src/routes/(marketing)/+layout.svelte (3)
2-2
: LGTM!The import statement for
WebsiteName
is correct and aligns with the objective of making the website name configurable.
8-8
: LGTM!The usage of
WebsiteName
in the navigation link is correct and improves flexibility.
21-34
: LGTM!The addition of the search link in the navigation menu improves user experience by providing direct access to the search feature.
Also applies to: 62-62
src/lib/mailer.test.ts (6)
1-3
: LGTM!The mock statements for dependencies are correct and necessary for isolating the tests.
5-7
: LGTM!The import statements are correct and necessary for the tests.
9-39
: LGTM!The setup within the describe block is correct and necessary for the tests.
41-66
: LGTM!The test for
sendUserEmail
function is correctly implemented and verifies the expected behavior.
68-99
: LGTM!The test for unsubscribed user in
sendUserEmail
function is correctly implemented and verifies the expected behavior.
102-119
: LGTM!The test for
sendTemplatedEmail
function is correctly implemented and verifies the expected behavior.src/routes/(admin)/account/(menu)/settings/settings_module.svelte (3)
33-34
: LGTM!The type changes for
editButtonTitle
andeditLink
improve flexibility and allow for better handling of null values.
52-52
: LGTM!The addition of the
md:pr-8
class likely affects the padding on medium-sized screens and improves the layout.
131-131
: LGTM!The refined conditional rendering logic ensures that the button only appears if both
editButtonTitle
andeditLink
are provided, preventing potential errors.src/routes/(admin)/account/api/page.server.test.ts (8)
1-3
: LGTM!The import statements are correct and necessary for the tests.
5-14
: LGTM!The mock setup for
@sveltejs/kit
is correct and necessary for the tests.
16-24
: LGTM!The
describe
block fortoggleEmailSubscription
is correctly structured and contains relevant test cases.
27-29
: LGTM!The
beforeEach
block is correctly implemented.
31-44
: LGTM!The test case for redirecting if no session is correctly implemented and covers the scenario.
46-71
: LGTM!The test case for toggling subscription status from false to true is correctly implemented and covers the scenario.
73-97
: LGTM!The test case for toggling subscription status from true to false is correctly implemented and covers the scenario.
100-122
: LGTM!The test case for handling update operation failure is correctly implemented and covers the scenario.
src/routes/(marketing)/search/+page.svelte (7)
1-7
: LGTM!The import statements are correct and necessary for the component.
9-17
: LGTM!The
fuseOptions
configuration is correct and necessary for the search functionality.
23-41
: LGTM!The
onMount
function is correctly implemented and handles errors appropriately.
43-50
: LGTM!The
Result
type definition is correct and necessary for type safety.
53-65
: LGTM!The search query logic is correctly implemented and updates the results appropriately.
67-83
: LGTM!The
onKeyDown
function is correctly implemented and handles keyboard events appropriately.
87-156
: LGTM!The HTML structure is correctly implemented and follows best practices for accessibility and responsiveness.
src/lib/mailer.ts (4)
1-6
: LGTM!The import statements are correct and necessary for the functions.
8-37
: LGTM!The
sendAdminEmail
function is correctly implemented and handles errors appropriately.
39-101
: LGTM!The
sendUserEmail
function is correctly implemented and handles various scenarios appropriately.
103-175
: LGTM!The
sendTemplatedEmail
function is correctly implemented and handles optional plaintext and HTML bodies appropriately.src/routes/(admin)/account/(menu)/+layout.svelte (2)
5-5
: LGTM!The import statement for
WebsiteName
is correct.
27-27
: LGTM!The usage of
WebsiteName
in the template is correct and improves maintainability and flexibility.Also applies to: 63-63
README.md (11)
1-12
: LGTM!The introduction section with the centered image and reformatting of badges enhances the visual appeal and usability of the document.
14-18
: LGTM!The section with links to the demo, quick start guide, and issues improves navigation and accessibility.
Line range hint
33-61
: LGTM!The demo section with images and links enhances the visual representation and provides a clear example of the project's capabilities.
63-71
: LGTM!The features section provides a comprehensive overview of the project's features.
Tools
LanguageTool
[style] ~64-~64: This phrase is redundant (‘O’ stands for ‘optimization’). Use simply “SEO”.
Context: ...r European users. - Marketing Page with SEO optimization and Sitemap - Blog engine with rich for...(ACRONYM_TAUTOLOGY)
[style] ~65-~65: This phrase is redundant (‘O’ stands for ‘optimization’). Use simply “SEO”.
Context: ...og engine with rich formatting, RSS and SEO optimization. - User Dashboard with user profile, us...(ACRONYM_TAUTOLOGY)
Line range hint
72-75
: LGTM!The introduction blog post section provides additional context and resources for users.
Tools
LanguageTool
[style] ~64-~64: This phrase is redundant (‘O’ stands for ‘optimization’). Use simply “SEO”.
Context: ...r European users. - Marketing Page with SEO optimization and Sitemap - Blog engine with rich for...(ACRONYM_TAUTOLOGY)
[style] ~65-~65: This phrase is redundant (‘O’ stands for ‘optimization’). Use simply “SEO”.
Context: ...og engine with rich formatting, RSS and SEO optimization. - User Dashboard with user profile, us...(ACRONYM_TAUTOLOGY)
Line range hint
76-86
: LGTM!The tech stack section provides a clear overview of the technologies used in the project.
Line range hint
87-105
: LGTM!The suggested hosting stack section provides valuable information for users considering hosting options.
Line range hint
106-138
: LGTM!The performance/best practices section provides a clear explanation of the performance and best practices followed in the project.
Tools
LanguageTool
[uncategorized] ~143-~143: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...sing CMSaasStarter as a starter template and you aren't planning on contributing wor...(COMMA_COMPOUND_SENTENCE)
[uncategorized] ~143-~143: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...on contributing work back to the public open source project. See [Github Docs](https://docs...(EN_COMPOUND_ADJECTIVE_INTERNAL)
[grammar] ~144-~144: The verb “contribute” needs to be in the to-infinitive form.
Context: ...late). - "Fork": use this button if you want contribute some or all of your work back to the pu...(MISSING_TO_BEFORE_A_VERB)
[uncategorized] ~144-~144: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ... or all of your work back to the public open source project. It will keep the full commit h...(EN_COMPOUND_ADJECTIVE_INTERNAL)
[uncategorized] ~172-~172: Possible missing comma found.
Context: ...ools Locally To manually run all these tools run the following script. You can view ...(AI_HYDRA_LEO_MISSING_COMMA)
Markdownlint
150-150: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
174-174: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
191-191: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
Line range hint
239-260
: LGTM!The setup Stripe section provides detailed and clear instructions for setting up Stripe.
Tools
LanguageTool
[style] ~252-~252: In American English, abbreviations like “etc.” require a period.
Context: ... for the same product (annual, monthly, etc). The stripe_price_id you choose to put...(ETC_PERIOD)
292-296
: LGTM!The setup emailer section provides clear instructions for setting up the emailer.
Line range hint
298-324
: LGTM!The add your content section provides a comprehensive checklist for customizing the template.
Tools
LanguageTool
[uncategorized] ~327-~327: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ... product. ## Community Extensions The open source community is extending and improving Sa...(EN_COMPOUND_ADJECTIVE_INTERNAL)
[typographical] ~329-~329: Consider adding a comma here.
Context: ...plify maintenance. However, if you need them you can cherry pick into your fork/repo...(IF_COMMA)
[misspelling] ~329-~329: This word is normally spelled with a hyphen.
Context: ...ance. However, if you need them you can cherry pick into your fork/repo: - Internationaliz...(EN_COMPOUNDS_CHERRY_PICK)
src/routes/(marketing)/+page.svelte (6)
23-23
: LGTM!The link update for "Free to host" is appropriate and improves the user experience by directing them to a more relevant section.
109-120
: LGTM!The new entry "Search" is well-structured and provides useful information about the search feature.
122-128
: LGTM!The new entry "Email" is well-structured and provides useful information about the email feature.
175-175
: LGTM!The link update for "Developer Environment" to "Developer Tools" aligns the terminology with the content's intent and improves clarity.
190-190
: LGTM!The correction from "Scaleable" to "Scalable" fixes a typographical error and improves readability.
212-219
: LGTM!The new entry "Open Source" is well-structured and provides useful information about the open-source nature of the project.
<script lang="ts"> | ||
import { WebsiteBaseUrl } from '../../config'; | ||
|
||
// Email template is MIT open source from https://github.com/leemunroe/responsive-html-email-template | ||
// See full license https://github.com/leemunroe/responsive-html-email-template/blob/master/license.txt | ||
|
||
// must be set to true to render email on server | ||
export const ssr = true | ||
|
||
// Define all your props here | ||
export let companyName: string = "" | ||
</script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add validation for the companyName
prop.
While the script section is correctly implemented, it is advisable to validate the companyName
prop to ensure it is not empty.
Apply this diff to add validation for the companyName
prop:
<script lang="ts">
import { WebsiteBaseUrl } from '../../config';
// Email template is MIT open source from https://github.com/leemunroe/responsive-html-email-template
// See full license https://github.com/leemunroe/responsive-html-email-template/blob/master/license.txt
// must be set to true to render email on server
export const ssr = true
// Define all your props here
export let companyName: string = ""
+ if (!companyName) {
+ throw new Error("companyName prop is required")
+ }
</script>
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. Thoroughly test & benchmark the code to ensure it meets the requirements.
<script lang="ts"> | |
import { WebsiteBaseUrl } from '../../config'; | |
// Email template is MIT open source from https://github.com/leemunroe/responsive-html-email-template | |
// See full license https://github.com/leemunroe/responsive-html-email-template/blob/master/license.txt | |
// must be set to true to render email on server | |
export const ssr = true | |
// Define all your props here | |
export let companyName: string = "" | |
</script> | |
<script lang="ts"> | |
import { WebsiteBaseUrl } from '../../config'; | |
// Email template is MIT open source from https://github.com/leemunroe/responsive-html-email-template | |
// See full license https://github.com/leemunroe/responsive-html-email-template/blob/master/license.txt | |
// must be set to true to render email on server | |
export const ssr = true | |
// Define all your props here | |
export let companyName: string = "" | |
if (!companyName) { | |
throw new Error("companyName prop is required") | |
} | |
</script> |
style="font-family: Helvetica, sans-serif; font-size: 16px; vertical-align: top; border-radius: 4px; text-align: center; background-color: #0867ec;" | ||
valign="top" | ||
align="center" | ||
> | ||
<a | ||
href="https://github.com/CriticalMoments/CMSaasStarter" | ||
target="_blank" | ||
style="border: solid 2px #0867ec; border-radius: 4px; box-sizing: border-box; cursor: pointer; display: inline-block; font-size: 16px; font-weight: bold; margin: 0; padding: 12px 24px; text-decoration: none; text-transform: capitalize; background-color: #0867ec; border-color: #0867ec; color: #ffffff;" | ||
>View SaaS Starter Docs</a | ||
> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<p | ||
style="font-family: Helvetica, sans-serif; font-size: 16px; font-weight: normal; margin: 0; margin-bottom: 16px;" | ||
> | ||
Thanks for using {companyName}! | ||
</p> | ||
</td> | ||
</tr> | ||
|
||
<!-- END MAIN CONTENT AREA --> | ||
</table> | ||
|
||
<!-- START FOOTER --> | ||
<div | ||
class="footer" | ||
style="clear: both; padding-top: 24px; text-align: center; width: 100%;" | ||
> | ||
<table | ||
role="presentation" | ||
border="0" | ||
cellpadding="0" | ||
cellspacing="0" | ||
style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;" | ||
width="100%" | ||
> | ||
<tr> | ||
<td | ||
class="content-block" | ||
style="font-family: Helvetica, sans-serif; vertical-align: top; color: #9a9ea6; font-size: 16px; text-align: center;" | ||
valign="top" | ||
align="center" | ||
> | ||
<span | ||
class="apple-link" | ||
style="color: #9a9ea6; font-size: 16px; text-align: center;" | ||
>Company Inc, 123 Main St, Toronto, Canada</span | ||
> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td | ||
class="content-block powered-by" | ||
style="font-family: Helvetica, sans-serif; vertical-align: top; color: #9a9ea6; font-size: 16px; text-align: center;" | ||
valign="top" | ||
align="center" | ||
> | ||
Email Template by <a | ||
href="http://htmlemail.io" | ||
style="color: #9a9ea6; font-size: 16px; text-align: center; text-decoration: none;" | ||
>HTMLemail.io</a | ||
> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td | ||
class="content-block" | ||
style="font-family: Helvetica, sans-serif; vertical-align: top; color: #9a9ea6; font-size: 14px; text-align: center;" | ||
valign="top" | ||
align="center" | ||
> | ||
<a | ||
href="{WebsiteBaseUrl}/account/settings/change_email_subscription" | ||
style="color: #4382ff; font-size: 16px; text-align: center; text-decoration: underline;" | ||
>Unsubscribe</a | ||
> | ||
</td> | ||
</tr> | ||
</table> | ||
</div> | ||
|
||
<!-- END FOOTER --> | ||
|
||
<!-- END CENTERED WHITE CONTAINER --> | ||
</div> | ||
</td> | ||
<td | ||
style="font-family: Helvetica, sans-serif; font-size: 16px; vertical-align: top;" | ||
valign="top"> </td | ||
> | ||
</tr> | ||
</table> | ||
</body> | ||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve prop handling and link usage.
Set a default value for the companyName
prop and use the WebsiteBaseUrl
prop for the unsubscribe link.
Apply this diff to improve the code:
export let companyName: string = ""
+export let WebsiteBaseUrl: string = ""
<a
href="{WebsiteBaseUrl}/account/settings/change_email_subscription"
style="color: #4382ff; font-size: 16px; text-align: center; text-decoration: underline;"
>Unsubscribe</a
>
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. Thoroughly test & benchmark the code to ensure it meets the requirements.
<script lang="ts"> | |
import { WebsiteBaseUrl } from "../../config" | |
// This email template is a fork of this MIT open source project: https://github.com/leemunroe/responsive-html-email-template | |
// See full license https://github.com/leemunroe/responsive-html-email-template/blob/master/license.txt | |
// Ignore the whole file - email HTML is HTML from 2003 and we shouldn't try to validate it | |
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | |
// @ts-nocheck | |
// must be set to true to render email on server | |
export const ssr = true | |
// Define all your props here | |
export let companyName: string = "" | |
</script> | |
<html lang="en"> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<title>Simple Transactional Email</title> | |
<style media="all" type="text/css"> | |
@media all { | |
.btn-primary table td:hover { | |
background-color: #ec0867 !important; | |
} | |
.btn-primary a:hover { | |
background-color: #ec0867 !important; | |
border-color: #ec0867 !important; | |
} | |
} | |
@media only screen and (max-width: 640px) { | |
.main p, | |
.main td, | |
.main span { | |
font-size: 16px !important; | |
} | |
.wrapper { | |
padding: 8px !important; | |
} | |
.content { | |
padding: 0 !important; | |
} | |
.container { | |
padding: 0 !important; | |
padding-top: 8px !important; | |
width: 100% !important; | |
} | |
.main { | |
border-left-width: 0 !important; | |
border-radius: 0 !important; | |
border-right-width: 0 !important; | |
} | |
.btn table { | |
max-width: 100% !important; | |
width: 100% !important; | |
} | |
.btn a { | |
font-size: 16px !important; | |
max-width: 100% !important; | |
width: 100% !important; | |
} | |
} | |
@media all { | |
.ExternalClass { | |
width: 100%; | |
} | |
.ExternalClass, | |
.ExternalClass p, | |
.ExternalClass span, | |
.ExternalClass font, | |
.ExternalClass td, | |
.ExternalClass div { | |
line-height: 100%; | |
} | |
.apple-link a { | |
color: inherit !important; | |
font-family: inherit !important; | |
font-size: inherit !important; | |
font-weight: inherit !important; | |
line-height: inherit !important; | |
text-decoration: none !important; | |
} | |
#MessageViewBody a { | |
color: inherit; | |
text-decoration: none; | |
font-size: inherit; | |
font-family: inherit; | |
font-weight: inherit; | |
line-height: inherit; | |
} | |
} | |
</style> | |
</head> | |
<body | |
style="font-family: Helvetica, sans-serif; -webkit-font-smoothing: antialiased; font-size: 16px; line-height: 1.3; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; background-color: #f4f5f6; margin: 0; padding: 0;" | |
> | |
<table | |
role="presentation" | |
border="0" | |
cellpadding="0" | |
cellspacing="0" | |
class="body" | |
style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; background-color: #f4f5f6; width: 100%;" | |
width="100%" | |
bgcolor="#f4f5f6" | |
> | |
<tr> | |
<td | |
style="font-family: Helvetica, sans-serif; font-size: 16px; vertical-align: top;" | |
valign="top"> </td | |
> | |
<td | |
class="container" | |
style="font-family: Helvetica, sans-serif; font-size: 16px; vertical-align: top; max-width: 600px; padding: 0; padding-top: 24px; width: 600px; margin: 0 auto;" | |
width="600" | |
valign="top" | |
> | |
<div | |
class="content" | |
style="box-sizing: border-box; display: block; margin: 0 auto; max-width: 600px; padding: 0;" | |
> | |
<!-- START CENTERED WHITE CONTAINER --> | |
<span | |
class="preheader" | |
style="color: transparent; display: none; height: 0; max-height: 0; max-width: 0; opacity: 0; overflow: hidden; mso-hide: all; visibility: hidden; width: 0;" | |
>Welcome to {companyName}. We're excited to have you on board.</span | |
> | |
<table | |
role="presentation" | |
border="0" | |
cellpadding="0" | |
cellspacing="0" | |
class="main" | |
style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; background: #ffffff; border: 1px solid #eaebed; border-radius: 16px; width: 100%;" | |
width="100%" | |
> | |
<!-- START MAIN CONTENT AREA --> | |
<tr> | |
<td | |
class="wrapper" | |
style="font-family: Helvetica, sans-serif; font-size: 16px; vertical-align: top; box-sizing: border-box; padding: 24px;" | |
valign="top" | |
> | |
<p | |
style="font-family: Helvetica, sans-serif; font-size: 16px; font-weight: normal; margin: 0; margin-bottom: 16px;" | |
> | |
Welcome to {companyName}! | |
</p> | |
<p | |
style="font-family: Helvetica, sans-serif; font-size: 16px; font-weight: normal; margin: 0; margin-bottom: 16px;" | |
> | |
This is a quick sample of a welcome email. You can customize | |
this email to fit your needs. | |
</p> | |
<table | |
role="presentation" | |
border="0" | |
cellpadding="0" | |
cellspacing="0" | |
class="btn btn-primary" | |
style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; box-sizing: border-box; width: 100%; min-width: 100%;" | |
width="100%" | |
> | |
<tbody> | |
<tr> | |
<td | |
align="left" | |
style="font-family: Helvetica, sans-serif; font-size: 16px; vertical-align: top; padding-bottom: 16px;" | |
valign="top" | |
> | |
<table | |
role="presentation" | |
border="0" | |
cellpadding="0" | |
cellspacing="0" | |
style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: auto;" | |
> | |
<tbody> | |
<tr> | |
<td | |
style="font-family: Helvetica, sans-serif; font-size: 16px; vertical-align: top; border-radius: 4px; text-align: center; background-color: #0867ec;" | |
valign="top" | |
align="center" | |
> | |
<a | |
href="https://github.com/CriticalMoments/CMSaasStarter" | |
target="_blank" | |
style="border: solid 2px #0867ec; border-radius: 4px; box-sizing: border-box; cursor: pointer; display: inline-block; font-size: 16px; font-weight: bold; margin: 0; padding: 12px 24px; text-decoration: none; text-transform: capitalize; background-color: #0867ec; border-color: #0867ec; color: #ffffff;" | |
>View SaaS Starter Docs</a | |
> | |
</td> | |
</tr> | |
</tbody> | |
</table> | |
</td> | |
</tr> | |
</tbody> | |
</table> | |
<p | |
style="font-family: Helvetica, sans-serif; font-size: 16px; font-weight: normal; margin: 0; margin-bottom: 16px;" | |
> | |
Thanks for using {companyName}! | |
</p> | |
</td> | |
</tr> | |
<!-- END MAIN CONTENT AREA --> | |
</table> | |
<!-- START FOOTER --> | |
<div | |
class="footer" | |
style="clear: both; padding-top: 24px; text-align: center; width: 100%;" | |
> | |
<table | |
role="presentation" | |
border="0" | |
cellpadding="0" | |
cellspacing="0" | |
style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;" | |
width="100%" | |
> | |
<tr> | |
<td | |
class="content-block" | |
style="font-family: Helvetica, sans-serif; vertical-align: top; color: #9a9ea6; font-size: 16px; text-align: center;" | |
valign="top" | |
align="center" | |
> | |
<span | |
class="apple-link" | |
style="color: #9a9ea6; font-size: 16px; text-align: center;" | |
>Company Inc, 123 Main St, Toronto, Canada</span | |
> | |
</td> | |
</tr> | |
<tr> | |
<td | |
class="content-block powered-by" | |
style="font-family: Helvetica, sans-serif; vertical-align: top; color: #9a9ea6; font-size: 16px; text-align: center;" | |
valign="top" | |
align="center" | |
> | |
Email Template by <a | |
href="http://htmlemail.io" | |
style="color: #9a9ea6; font-size: 16px; text-align: center; text-decoration: none;" | |
>HTMLemail.io</a | |
> | |
</td> | |
</tr> | |
<tr> | |
<td | |
class="content-block" | |
style="font-family: Helvetica, sans-serif; vertical-align: top; color: #9a9ea6; font-size: 14px; text-align: center;" | |
valign="top" | |
align="center" | |
> | |
<a | |
href="{WebsiteBaseUrl}/account/settings/change_email_subscription" | |
style="color: #4382ff; font-size: 16px; text-align: center; text-decoration: underline;" | |
>Unsubscribe</a | |
> | |
</td> | |
</tr> | |
</table> | |
</div> | |
<!-- END FOOTER --> | |
<!-- END CENTERED WHITE CONTAINER --> | |
</div> | |
</td> | |
<td | |
style="font-family: Helvetica, sans-serif; font-size: 16px; vertical-align: top;" | |
valign="top"> </td | |
> | |
</tr> | |
</table> | |
</body> | |
</html> | |
<script lang="ts"> | |
import { WebsiteBaseUrl } from "../../config" | |
// This email template is a fork of this MIT open source project: https://github.com/leemunroe/responsive-html-email-template | |
// See full license https://github.com/leemunroe/responsive-html-email-template/blob/master/license.txt | |
// Ignore the whole file - email HTML is HTML from 2003 and we shouldn't try to validate it | |
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | |
// @ts-nocheck | |
// must be set to true to render email on server | |
export const ssr = true | |
// Define all your props here | |
export let companyName: string = "" | |
export let WebsiteBaseUrl: string = "" | |
</script> | |
<html lang="en"> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<title>Simple Transactional Email</title> | |
<style media="all" type="text/css"> | |
@media all { | |
.btn-primary table td:hover { | |
background-color: #ec0867 !important; | |
} | |
.btn-primary a:hover { | |
background-color: #ec0867 !important; | |
border-color: #ec0867 !important; | |
} | |
} | |
@media only screen and (max-width: 640px) { | |
.main p, | |
.main td, | |
.main span { | |
font-size: 16px !important; | |
} | |
.wrapper { | |
padding: 8px !important; | |
} | |
.content { | |
padding: 0 !important; | |
} | |
.container { | |
padding: 0 !important; | |
padding-top: 8px !important; | |
width: 100% !important; | |
} | |
.main { | |
border-left-width: 0 !important; | |
border-radius: 0 !important; | |
border-right-width: 0 !important; | |
} | |
.btn table { | |
max-width: 100% !important; | |
width: 100% !important; | |
} | |
.btn a { | |
font-size: 16px !important; | |
max-width: 100% !important; | |
width: 100% !important; | |
} | |
} | |
@media all { | |
.ExternalClass { | |
width: 100%; | |
} | |
.ExternalClass, | |
.ExternalClass p, | |
.ExternalClass span, | |
.ExternalClass font, | |
.ExternalClass td, | |
.ExternalClass div { | |
line-height: 100%; | |
} | |
.apple-link a { | |
color: inherit !important; | |
font-family: inherit !important; | |
font-size: inherit !important; | |
font-weight: inherit !important; | |
line-height: inherit !important; | |
text-decoration: none !important; | |
} | |
#MessageViewBody a { | |
color: inherit; | |
text-decoration: none; | |
font-size: inherit; | |
font-family: inherit; | |
font-weight: inherit; | |
line-height: inherit; | |
} | |
} | |
</style> | |
</head> | |
<body | |
style="font-family: Helvetica, sans-serif; -webkit-font-smoothing: antialiased; font-size: 16px; line-height: 1.3; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; background-color: #f4f5f6; margin: 0; padding: 0;" | |
> | |
<table | |
role="presentation" | |
border="0" | |
cellpadding="0" | |
cellspacing="0" | |
class="body" | |
style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; background-color: #f4f5f6; width: 100%;" | |
width="100%" | |
bgcolor="#f4f5f6" | |
> | |
<tr> | |
<td | |
style="font-family: Helvetica, sans-serif; font-size: 16px; vertical-align: top;" | |
valign="top"> </td | |
> | |
<td | |
class="container" | |
style="font-family: Helvetica, sans-serif; font-size: 16px; vertical-align: top; max-width: 600px; padding: 0; padding-top: 24px; width: 600px; margin: 0 auto;" | |
width="600" | |
valign="top" | |
> | |
<div | |
class="content" | |
style="box-sizing: border-box; display: block; margin: 0 auto; max-width: 600px; padding: 0;" | |
> | |
<!-- START CENTERED WHITE CONTAINER --> | |
<span | |
class="preheader" | |
style="color: transparent; display: none; height: 0; max-height: 0; max-width: 0; opacity: 0; overflow: hidden; mso-hide: all; visibility: hidden; width: 0;" | |
>Welcome to {companyName}. We're excited to have you on board.</span | |
> | |
<table | |
role="presentation" | |
border="0" | |
cellpadding="0" | |
cellspacing="0" | |
class="main" | |
style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; background: #ffffff; border: 1px solid #eaebed; border-radius: 16px; width: 100%;" | |
width="100%" | |
> | |
<!-- START MAIN CONTENT AREA --> | |
<tr> | |
<td | |
class="wrapper" | |
style="font-family: Helvetica, sans-serif; font-size: 16px; vertical-align: top; box-sizing: border-box; padding: 24px;" | |
valign="top" | |
> | |
<p | |
style="font-family: Helvetica, sans-serif; font-size: 16px; font-weight: normal; margin: 0; margin-bottom: 16px;" | |
> | |
Welcome to {companyName}! | |
</p> | |
<p | |
style="font-family: Helvetica, sans-serif; font-size: 16px; font-weight: normal; margin: 0; margin-bottom: 16px;" | |
> | |
This is a quick sample of a welcome email. You can customize | |
this email to fit your needs. | |
</p> | |
<table | |
role="presentation" | |
border="0" | |
cellpadding="0" | |
cellspacing="0" | |
class="btn btn-primary" | |
style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; box-sizing: border-box; width: 100%; min-width: 100%;" | |
width="100%" | |
> | |
<tbody> | |
<tr> | |
<td | |
align="left" | |
style="font-family: Helvetica, sans-serif; font-size: 16px; vertical-align: top; padding-bottom: 16px;" | |
valign="top" | |
> | |
<table | |
role="presentation" | |
border="0" | |
cellpadding="0" | |
cellspacing="0" | |
style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: auto;" | |
> | |
<tbody> | |
<tr> | |
<td | |
style="font-family: Helvetica, sans-serif; font-size: 16px; vertical-align: top; border-radius: 4px; text-align: center; background-color: #0867ec;" | |
valign="top" | |
align="center" | |
> | |
<a | |
href="https://github.com/CriticalMoments/CMSaasStarter" | |
target="_blank" | |
style="border: solid 2px #0867ec; border-radius: 4px; box-sizing: border-box; cursor: pointer; display: inline-block; font-size: 16px; font-weight: bold; margin: 0; padding: 12px 24px; text-decoration: none; text-transform: capitalize; background-color: #0867ec; border-color: #0867ec; color: #ffffff;" | |
>View SaaS Starter Docs</a | |
> | |
</td> | |
</tr> | |
</tbody> | |
</table> | |
</td> | |
</tr> | |
</tbody> | |
</table> | |
<p | |
style="font-family: Helvetica, sans-serif; font-size: 16px; font-weight: normal; margin: 0; margin-bottom: 16px;" | |
> | |
Thanks for using {companyName}! | |
</p> | |
</td> | |
</tr> | |
<!-- END MAIN CONTENT AREA --> | |
</table> | |
<!-- START FOOTER --> | |
<div | |
class="footer" | |
style="clear: both; padding-top: 24px; text-align: center; width: 100%;" | |
> | |
<table | |
role="presentation" | |
border="0" | |
cellpadding="0" | |
cellspacing="0" | |
style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;" | |
width="100%" | |
> | |
<tr> | |
<td | |
class="content-block" | |
style="font-family: Helvetica, sans-serif; vertical-align: top; color: #9a9ea6; font-size: 16px; text-align: center;" | |
valign="top" | |
align="center" | |
> | |
<span | |
class="apple-link" | |
style="color: #9a9ea6; font-size: 16px; text-align: center;" | |
>Company Inc, 123 Main St, Toronto, Canada</span | |
> | |
</td> | |
</tr> | |
<tr> | |
<td | |
class="content-block powered-by" | |
style="font-family: Helvetica, sans-serif; vertical-align: top; color: #9a9ea6; font-size: 16px; text-align: center;" | |
valign="top" | |
align="center" | |
> | |
Email Template by <a | |
href="http://htmlemail.io" | |
style="color: #9a9ea6; font-size: 16px; text-align: center; text-decoration: none;" | |
>HTMLemail.io</a | |
> | |
</td> | |
</tr> | |
<tr> | |
<td | |
class="content-block" | |
style="font-family: Helvetica, sans-serif; vertical-align: top; color: #9a9ea6; font-size: 14px; text-align: center;" | |
valign="top" | |
align="center" | |
> | |
<a | |
href="{WebsiteBaseUrl}/account/settings/change_email_subscription" | |
style="color: #4382ff; font-size: 16px; text-align: center; text-decoration: underline;" | |
>Unsubscribe</a | |
> | |
</td> | |
</tr> | |
</table> | |
</div> | |
<!-- END FOOTER --> | |
<!-- END CENTERED WHITE CONTAINER --> | |
</div> | |
</td> | |
<td | |
style="font-family: Helvetica, sans-serif; font-size: 16px; vertical-align: top;" | |
valign="top"> </td | |
> | |
</tr> | |
</table> | |
</body> | |
</html> |
README.md
Outdated
## Developer Tools | ||
|
||
The repo includes [CI scripts](https://aws.amazon.com/devops/continuous-integration/) designed for [GitHub Actions](https://github.com/features/actions). These confirm you don’t break your [build](https://github.com/CriticalMoments/CMSaasStarter/blob/main/.github/workflows/build.yml), you use [proper code formatting](https://github.com/CriticalMoments/CMSaasStarter/blob/main/.github/workflows/format.yml), and [code linting and typechecking passes](https://github.com/CriticalMoments/CMSaasStarter/blob/main/.github/workflows/linting.yml). Github disables CI on forks by default, so if you fork this repo, be sure to go into the Github Actions page for your repo and enable workflows. | ||
The repo includes [CI scripts](https://aws.amazon.com/devops/continuous-integration/) designed for [GitHub Actions](https://github.com/features/actions). These confirm you don’t break your [build](https://github.com/CriticalMoments/CMSaasStarter/blob/main/.github/workflows/build.yml), you use [proper code formatting](https://github.com/CriticalMoments/CMSaasStarter/blob/main/.github/workflows/format.yml), [code linting and typechecking passes](https://github.com/CriticalMoments/CMSaasStarter/blob/main/.github/workflows/linting.yml), and even spell checking. | ||
|
||
### Enabling GitHub Actions | ||
|
||
Github disables CI on new forks by default, so be sure to go into the Github Actions page for your repo and enable workflows. | ||
|
||
### Running Developer Tools Locally | ||
|
||
To manually run all these tools run the following script. You can view it's contents for individual commands. | ||
|
||
``` | ||
# first time only: chmod +x ./check.sh | ||
./check.sh | ||
``` | ||
|
||
You can manually run these scripts yourself; `npm run build` for the build, `npm run format_check` to check formatting, `npm run lint` for the linting, `npm run check` for typechecking, and `npm run test` for testing (if you add tests). | ||
### Running Developer Tools in your IDE | ||
|
||
Installing extensions in your editor can automatically format-on-save, show linting/type issues inline, and run your test cases: | ||
|
||
- Svelte for Svelte and accessibility issues: [VSCode](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode) or [other editors](https://sveltesociety.dev/tools#editor-support) | ||
- ESLint for type checking and linting: [VSCode](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [other editors](https://eslint.org/docs/latest/use/integrations) | ||
- Vitest for testing if you add tests: [VSCode](https://marketplace.visualstudio.com/items?itemName=vitest.explorer) or [other editors](https://vitest.dev/guide/ide) | ||
|
||
### Running Developer Tools from Git Hooks | ||
|
||
To catch build, formatting, linting and test issues before you commit changes, we suggest the following local git hook. It will run before you commit, stop you from breaking the build, and show any issues that are found. Add the lines below to an executable git hook script at the location `.git/hooks/pre-commit`. | ||
|
||
``` | ||
#!/bin/sh | ||
set -e | ||
npm run format_check | ||
npm run lint | ||
npm run build | ||
npm run check | ||
npm run test_run | ||
# Run standard checks before committing | ||
cd "$(dirname "$0")" | ||
sh ../../checks.sh | ||
``` | ||
|
||
Finally: if you find build, formatting or linting rules too tedious, you can disable enforcement by deleting the CI files (`.github/workflows/*`) and remove the git hook (`.git/hooks/pre-commit`). | ||
### Disabling Developer Tools | ||
|
||
If you find build, formatting or linting rules too tedious, you can disable enforcement by deleting the CI files (`.github/workflows/*`) and removing the git hook (`.git/hooks/pre-commit`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! But correct flagged issues.
The developer tools section provides comprehensive instructions for using developer tools. However, there are several flagged issues.
Apply this diff to correct the issues:
- Github disables CI on new forks by default, so be sure to go into the Github Actions page for your repo and enable workflows.
+ GitHub disables CI on new forks by default, so be sure to go into the GitHub Actions page for your repo and enable workflows.
- To manually run all these tools run the following script. You can view it's contents for individual commands.
+ To manually run all these tools, run the following script. You can view its contents for individual commands.
```diff
-```
+```sh
- +
sh
-```
+```sh
<details>
<summary>Tools</summary>
<details>
<summary>LanguageTool</summary><blockquote>
[uncategorized] ~172-~172: Possible missing comma found.
Context: ...ools Locally To manually run all these tools run the following script. You can view ...
(AI_HYDRA_LEO_MISSING_COMMA)
</blockquote></details>
<details>
<summary>Markdownlint</summary><blockquote>
174-174: null
Fenced code blocks should have a language specified
(MD040, fenced-code-language)
---
191-191: null
Fenced code blocks should have a language specified
(MD040, fenced-code-language)
</blockquote></details>
</details>
<!-- This is an auto-generated comment by CodeRabbit -->
README.md
Outdated
## Create a Copy of the Template | ||
|
||
To get started, create your own copy of the project for development. There are two options: | ||
|
||
To get started, fork and run this project! | ||
- "Use this template": use this Github button if you want to build your own project using CMSaasStarter as a starter template and you aren't planning on contributing work back to the public open source project. See [Github Docs](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template). | ||
- "Fork": use this button if you want contribute some or all of your work back to the public open source project. It will keep the full commit history, and be easier to create PRs back to CMSaasStarter. | ||
|
||
## Setup Local Development | ||
|
||
On your development machine: | ||
|
||
``` | ||
## First fork the project on Github | ||
git pull [Your Fork] | ||
cd CMSaasStarter ## or your fork name if different | ||
git pull [Your Repo Created Above] | ||
cd CMSaasStarter ## or your repo name if different | ||
npm install | ||
## Create an env file. You'll replace the values in this in later steps. | ||
cp local_env_template .env.local | ||
## Run the project locally in dev mode, and launch the browser | ||
npm run dev -- --open | ||
``` | ||
|
||
### Developer Environment | ||
**Note:** some features won't work until you complete the rest of the setup steps below! | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! But correct grammar and style issues.
The quick start section provides clear instructions for getting started with the project. However, there are several grammar and style issues.
Apply this diff to correct the issues:
- "Use this template": use this Github button if you want to build your own project using CMSaasStarter as a starter template and you aren't planning on contributing work back to the public open source project. See [Github Docs](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template).
+ "Use this template": use this Github button if you want to build your own project using CMSaasStarter as a starter template, and you aren't planning on contributing work back to the public open-source project. See [Github Docs](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template).
- "Fork": use this button if you want contribute some or all of your work back to the public open source project. It will keep the full commit history, and be easier to create PRs back to CMSaasStarter.
+ "Fork": use this button if you want to contribute some or all of your work back to the public open-source project. It will keep the full commit history and be easier to create PRs back to CMSaasStarter.
- To manually run all these tools run the following script. You can view it's contents for individual commands.
+ To manually run all these tools, run the following script. You can view its contents for individual commands.
Committable suggestion was skipped due to low confidence.
Tools
LanguageTool
[uncategorized] ~143-~143: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...sing CMSaasStarter as a starter template and you aren't planning on contributing wor...(COMMA_COMPOUND_SENTENCE)
[uncategorized] ~143-~143: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...on contributing work back to the public open source project. See [Github Docs](https://docs...(EN_COMPOUND_ADJECTIVE_INTERNAL)
[grammar] ~144-~144: The verb “contribute” needs to be in the to-infinitive form.
Context: ...late). - "Fork": use this button if you want contribute some or all of your work back to the pu...(MISSING_TO_BEFORE_A_VERB)
[uncategorized] ~144-~144: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ... or all of your work back to the public open source project. It will keep the full commit h...(EN_COMPOUND_ADJECTIVE_INTERNAL)
Markdownlint
150-150: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
README.md
Outdated
## Community Extensions | ||
|
||
The open source community is extending and improving SaasStarter! | ||
|
||
These extensions are reference implementations of commonly needed features. We don't integrate them into the main branch to keep our dependencies minimal and simplify maintenance. However, if you need them you can cherry pick into your fork: | ||
These extensions are reference implementations of commonly needed features. We don't integrate them into the main branch to keep our dependencies minimal and simplify maintenance. However, if you need them you can cherry pick into your fork/repo: | ||
|
||
- Internationalization: [branch](https://github.com/CriticalMoments/CMSaasStarter/tree/extension/internationalization), and [instructions](https://github.com/CriticalMoments/CMSaasStarter/pull/49) | ||
- Dark mode theme: [branch](https://github.com/CriticalMoments/CMSaasStarter/tree/extension/dark_mode), and [instructions](https://github.com/CriticalMoments/CMSaasStarter/pull/47) | ||
|
||
## Icons | ||
### Icons Credits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! But correct flagged issues.
The community extensions section provides valuable information about community extensions. However, there are several flagged issues.
Apply this diff to correct the issues:
- The open source community is extending and improving SaasStarter!
+ The open-source community is extending and improving SaasStarter!
- However, if you need them you can cherry pick into your fork/repo:
+ However, if you need them, you can cherry-pick into your fork/repo:
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. Thoroughly test & benchmark the code to ensure it meets the requirements.
## Community Extensions | |
The open source community is extending and improving SaasStarter! | |
These extensions are reference implementations of commonly needed features. We don't integrate them into the main branch to keep our dependencies minimal and simplify maintenance. However, if you need them you can cherry pick into your fork: | |
These extensions are reference implementations of commonly needed features. We don't integrate them into the main branch to keep our dependencies minimal and simplify maintenance. However, if you need them you can cherry pick into your fork/repo: | |
- Internationalization: [branch](https://github.com/CriticalMoments/CMSaasStarter/tree/extension/internationalization), and [instructions](https://github.com/CriticalMoments/CMSaasStarter/pull/49) | |
- Dark mode theme: [branch](https://github.com/CriticalMoments/CMSaasStarter/tree/extension/dark_mode), and [instructions](https://github.com/CriticalMoments/CMSaasStarter/pull/47) | |
## Icons | |
### Icons Credits | |
## Community Extensions | |
The open-source community is extending and improving SaasStarter! | |
These extensions are reference implementations of commonly needed features. We don't integrate them into the main branch to keep our dependencies minimal and simplify maintenance. However, if you need them, you can cherry-pick into your fork/repo: | |
- Internationalization: [branch](https://github.com/CriticalMoments/CMSaasStarter/tree/extension/internationalization), and [instructions](https://github.com/CriticalMoments/CMSaasStarter/pull/49) | |
- Dark mode theme: [branch](https://github.com/CriticalMoments/CMSaasStarter/tree/extension/dark_mode), and [instructions](https://github.com/CriticalMoments/CMSaasStarter/pull/47) | |
### Icons Credits |
Tools
LanguageTool
[uncategorized] ~327-~327: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ... product. ## Community Extensions The open source community is extending and improving Sa...(EN_COMPOUND_ADJECTIVE_INTERNAL)
[typographical] ~329-~329: Consider adding a comma here.
Context: ...plify maintenance. However, if you need them you can cherry pick into your fork/repo...(IF_COMMA)
[misspelling] ~329-~329: This word is normally spelled with a hyphen.
Context: ...ance. However, if you need them you can cherry pick into your fork/repo: - Internationaliz...(EN_COMPOUNDS_CHERRY_PICK)
Deploying saasstarter with Cloudflare Pages
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/routes/(admin)/account/api/+page.server.ts (8 hunks)
Additional comments not posted (6)
src/routes/(admin)/account/api/+page.server.ts (6)
Line range hint
6-24
: Improve redirection and error handling.Use
throw redirect
for immediate redirection and log the error for better debugging.Apply this diff to improve the code:
- if (!session) { - redirect(303, "/login") - } + if (!session) { + throw redirect(303, "/login") + } const { error } = await supabase .from("profiles") .update({ unsubscribed: newUnsubscribedStatus }) .eq("id", session.user.id) if (error) { + console.error("Failed to update subscription status:", error) return fail(500, { message: "Failed to update subscription status" }) }
Line range hint
25-55
: Improve redirection and error handling.Use
throw redirect
for immediate redirection and log the error for better debugging.Apply this diff to improve the code:
- if (!session) { - redirect(303, "/login") - } + if (!session) { + throw redirect(303, "/login") + } const { error } = await supabase.auth.updateUser({ email: email }) if (error) { + console.error("Failed to update email:", error) return fail(500, { errorMessage: "Unknown error. If this persists please contact us.", email, }) }
Line range hint
76-153
: Improve redirection and error handling.Use
throw redirect
for immediate redirection and log the error for better debugging.Apply this diff to improve the code:
- if (!session) { - redirect(303, "/login") - } + if (!session) { + throw redirect(303, "/login") + } if (!isRecoverySession) { const { error } = await supabase.auth.signInWithPassword({ email: user?.email || "", password: currentPassword, }) if (error) { + console.error("Failed to sign in with password:", error) // The user was logged out because of bad password. Redirect to error page explaining. throw redirect(303, "/login/current_password_error") } } const { error } = await supabase.auth.updateUser({ password: newPassword1, }) if (error) { + console.error("Failed to update password:", error) return fail(500, { errorMessage: "Unknown error. If this persists please contact us.", newPassword1, newPassword2, currentPassword, }) }
Line range hint
181-212
: Improve redirection and error handling.Use
throw redirect
for immediate redirection and log the error for better debugging.Apply this diff to improve the code:
- if (!session || !user?.id) { - redirect(303, "/login") - } + if (!session || !user?.id) { + throw redirect(303, "/login") + } const { error: pwError } = await supabase.auth.signInWithPassword({ email: user?.email || "", password: currentPassword, }) if (pwError) { + console.error("Failed to sign in with password:", pwError) // The user was logged out because of bad password. Redirect to error page explaining. throw redirect(303, "/login/current_password_error") } const { error } = await supabaseServiceRole.auth.admin.deleteUser( user.id, true, ) if (error) { + console.error("Failed to delete user:", error) return fail(500, { errorMessage: "Unknown error. If this persists please contact us.", currentPassword, }) }
Line range hint
223-287
: Improve redirection and error handling.Use
throw redirect
for immediate redirection and log the error for better debugging.Apply this diff to improve the code:
- if (!session || !user?.id) { - redirect(303, "/login") - } + if (!session || !user?.id) { + throw redirect(303, "/login") + } const { error } = await supabase .from("profiles") .upsert({ id: user.id, full_name: fullName, company_name: companyName, website: website, updated_at: new Date(), unsubscribed: priorProfile?.unsubscribed ?? false, }) .select() if (error) { + console.error("Failed to update profile:", error) return fail(500, { errorMessage: "Unknown error. If this persists please contact us.", fullName, companyName, website, }) }
Line range hint
288-297
: Improve redirection.Use
throw redirect
for immediate redirection.Apply this diff to improve the code:
- redirect(303, "/") + throw redirect(303, "/") - redirect(303, "/") + throw redirect(303, "/")
@kizivat did most of this, it's based on his PR here: Based on #63
My Github-fu isn't good enough to add my work to his PR.
This PR adds: getting up to speed with main, and suppressing the annoying warning.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Chores
Refactor