diff --git a/.github/workflows/deploy-supabase-on-push.yml b/.github/workflows/deploy-supabase-on-push.yml new file mode 100644 index 00000000..42647503 --- /dev/null +++ b/.github/workflows/deploy-supabase-on-push.yml @@ -0,0 +1,26 @@ +name: Deploy Supabase on Push + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + + env: + SUPABASE_ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} + SUPABASE_DB_PASSWORD: ${{ secrets.DB_PASSWORD }} + PROJECT_ID: tapaozmyjsuykgerrfkt + + steps: + - uses: actions/checkout@v3 + + - uses: supabase/setup-cli@v1 + with: + version: latest + + - run: supabase link --project-ref $PROJECT_ID + - run: supabase db push diff --git a/apps/dashboard/src/app.postcss b/apps/dashboard/src/app.postcss index e020804b..dc14774b 100644 --- a/apps/dashboard/src/app.postcss +++ b/apps/dashboard/src/app.postcss @@ -127,6 +127,14 @@ code { overflow-y: auto; } +@media screen and (max-width: 457px) { + .org-slot { + min-width: 100%; + max-height: calc(100vh - 48px); + overflow-y: auto; + } +} + @tailwind components; @tailwind utilities; diff --git a/apps/dashboard/src/lib/components/Org/Community/DeleteCommentModal.svelte b/apps/dashboard/src/lib/components/Org/Community/DeleteModal.svelte similarity index 70% rename from apps/dashboard/src/lib/components/Org/Community/DeleteCommentModal.svelte rename to apps/dashboard/src/lib/components/Org/Community/DeleteModal.svelte index 0679954c..faea14a3 100644 --- a/apps/dashboard/src/lib/components/Org/Community/DeleteCommentModal.svelte +++ b/apps/dashboard/src/lib/components/Org/Community/DeleteModal.svelte @@ -6,11 +6,19 @@ export let onDelete = () => {}; export let onCancel = () => {}; export let open = false; + export let isQuestion = false; - (open = false)} bind:open width="w-96" modalHeading="Delete comment"> + (open = false)} + bind:open + width="w-96" + modalHeading="Delete {isQuestion ? 'question' : 'comment'}" +>
-

Are you sure you want to delete this comment?

+

+ Are you sure you want to delete this {isQuestion ? 'question' : 'comment'}? +

+ diff --git a/apps/dashboard/src/routes/lms/community/[slug]/+page.svelte b/apps/dashboard/src/routes/lms/community/[slug]/+page.svelte index 8bfca0a3..d298efb0 100644 --- a/apps/dashboard/src/routes/lms/community/[slug]/+page.svelte +++ b/apps/dashboard/src/routes/lms/community/[slug]/+page.svelte @@ -1,4 +1,4 @@ - {question?.title || 'Question'} - { + deleteQuestion.shouldDelete = false; + deleteQuestion.questionId = ''; + }} + onDelete={() => handleDelete(true)} + isQuestion={true} +/> + + { deleteComment.shouldDelete = false; - deleteComment.commentId = null; + deleteComment.commentId = ''; }} - onDelete={handleCommentDelete} + onDelete={() => handleDelete(false)} />
{#if !question} @@ -322,6 +400,17 @@ {question.createdAt}

+ {#if question.author.id === $profile.id || $isOrgAdmin} + { + deleteQuestion.shouldDelete = true; + deleteQuestion.questionId = question.id; + }} + > + + + {/if} {#if isEditMode && editorInstance}
@@ -363,7 +452,7 @@ {/if} - {#if comment.authorId === $profile.id} + {#if comment.authorId === $profile.id || $isOrgAdmin} { diff --git a/apps/dashboard/src/routes/lms/community/ask/+page.svelte b/apps/dashboard/src/routes/lms/community/ask/+page.svelte index 5d27b44f..67fbbc71 100644 --- a/apps/dashboard/src/routes/lms/community/ask/+page.svelte +++ b/apps/dashboard/src/routes/lms/community/ask/+page.svelte @@ -9,6 +9,7 @@ import generateSlug from '$lib/utils/functions/generateSlug'; import TextEditor from '$lib/components/TextEditor/index.svelte'; import TextField from '$lib/components/Form/TextField.svelte'; + import { profile } from '$lib/utils/store/user'; let errors: { title?: string; @@ -31,7 +32,7 @@ .insert({ ...fields, organization_id: $currentOrg.id, - author_id: $currentOrg.memberId, + author_profile_id: $profile.id, votes: 0, slug: generateSlug(fields.title) }) @@ -41,10 +42,11 @@ console.error('Error: asking question', error); snackbar.error(); } else { - console.log('Success: asking question', question); + const slug = question[0]?.slug; + console.log('Success: asking question in lms', question, slug); snackbar.success(); - goto(`/lms/community/${question[0].slug}`); + goto(`/lms/community/${slug}`); } } @@ -65,11 +67,7 @@
- +
+ {question?.title || 'Question'} - { + deleteQuestion.shouldDelete = false; + deleteQuestion.questionId = ''; + }} + onDelete={() => handleDelete(true)} + isQuestion={true} +/> + + { deleteComment.shouldDelete = false; - deleteComment.commentId = null; + deleteComment.commentId = ''; }} - onDelete={handleCommentDelete} + onDelete={() => handleDelete(false)} />
{#if !question} @@ -324,6 +403,17 @@ {question.createdAt}

+ {#if question.author.id === $profile.id || $isOrgAdmin} + { + deleteQuestion.shouldDelete = true; + deleteQuestion.questionId = question.id; + }} + > + + + {/if} {#if isEditMode && editorInstance}
@@ -365,7 +455,7 @@ {/if} - {#if comment.authorId === $profile.id} + {#if comment.authorId === $profile.id || $isOrgAdmin} { diff --git a/apps/dashboard/src/routes/org/[slug]/community/ask/+page.svelte b/apps/dashboard/src/routes/org/[slug]/community/ask/+page.svelte index e22f597c..96496c09 100644 --- a/apps/dashboard/src/routes/org/[slug]/community/ask/+page.svelte +++ b/apps/dashboard/src/routes/org/[slug]/community/ask/+page.svelte @@ -9,6 +9,7 @@ import generateSlug from '$lib/utils/functions/generateSlug'; import TextEditor from '$lib/components/TextEditor/index.svelte'; import TextField from '$lib/components/Form/TextField.svelte'; + import { profile } from '$lib/utils/store/user'; let errors: { title?: string; @@ -31,7 +32,7 @@ .insert({ ...fields, organization_id: $currentOrg.id, - author_id: $currentOrg.memberId, + author_profile_id: $profile.id, votes: 0, slug: generateSlug(fields.title) }) @@ -41,9 +42,11 @@ console.error('Error: asking question', error); snackbar.error('Error - Please try again later'); } else { - console.log('Success: asking question', question); + const slug = question[0]?.slug; + + console.log('Success: asking question', question, slug); snackbar.success('Question Submitted!'); - goto(`${$currentOrgPath}/community/${question[0].slug}`); + goto(`${$currentOrgPath}/community/${slug}`); } } @@ -67,11 +70,7 @@
- +