Skip to content

Add designer role #1804

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/components/roles/roles.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Base>
<div class="u-flex-vertical u-gap-8">
<p class="u-bold">Roles</p>
<p>Owner, Developer, Editor, Analyst and Billing.</p>
<p>Owner, Developer, Editor, Analyst, Designer and Billing.</p>
<p>
<a
class="link"
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/roles/upgrade.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{#if isCloud}
{#if $organization?.billingPlan !== BillingPlan.FREE}
<Typography.Text variant="m-600">Roles</Typography.Text>
<Typography.Text>Owner, Developer, Editor, Analyst and Billing.</Typography.Text>
<Typography.Text>Owner, Developer, Editor, Analyst, Designer and Billing.</Typography.Text>
<Typography.Text>
<Link.Anchor
target="_blank"
Expand All @@ -29,7 +29,7 @@
<Badge variant="secondary" size="xs" content="Pro plan" />
</Layout.Stack>
<Typography.Text>
Upgrade to Pro to assign new roles to members such as Owner, Developer, Editor
Upgrade to Pro to assign new roles to members such as Owner, Developer, Editor, Designer
or Analyst.
</Typography.Text>

Expand Down
64 changes: 36 additions & 28 deletions src/lib/components/sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
import { Click, trackEvent } from '$lib/actions/analytics';

import type { HTMLAttributes } from 'svelte/elements';
import {
canSeeBuckets,
canSeeDatabases,
canSeeFunctions,
canSeeMessages,
} from '$lib/stores/roles';

type $$Props = HTMLAttributes<HTMLElement> & {
state?: 'closed' | 'open' | 'icons';
Expand Down Expand Up @@ -161,34 +167,36 @@
<div class="only-mobile divider">
<Divider />
</div>
<div class="products-label-container">
<span class="products-label" class:hidden={state === 'icons'}>Build</span>
<span class="products-label-indicator" class:hidden={state !== 'icons'}
></span>
</div>
{@const buildProjectOptions = projectOptions.filter(
(projectOption) => projectOption.category === 'build'
)}
{#each buildProjectOptions as projectOption}
<Tooltip placement="right" disabled={state !== 'icons'}>
<a
href={`/console/project-${project.$id}/${projectOption.slug}`}
class="link"
class:active={page.url.pathname.includes(projectOption.slug)}
on:click={() => {
trackEvent(`click_menu_${projectOption.slug}`);
sideBarIsOpen = false;
}}
><span class="link-icon"
><Icon icon={projectOption.icon} size="s" />
</span><span
class:no-text={state === 'icons'}
class:has-text={state === 'open'}
class="link-text">{projectOption.name}</span
></a>
<span slot="tooltip">{projectOption.name}</span>
</Tooltip>
{/each}
{#if $canSeeDatabases && $canSeeFunctions && $canSeeBuckets && $canSeeMessages}
<div class="products-label-container">
<span class="products-label" class:hidden={state === 'icons'}>Build</span>
<span class="products-label-indicator" class:hidden={state !== 'icons'}
></span>
</div>
{@const buildProjectOptions = projectOptions.filter(
(projectOption) => projectOption.category === 'build'
)}
{#each buildProjectOptions as projectOption}
<Tooltip placement="right" disabled={state !== 'icons'}>
<a
href={`/console/project-${project.$id}/${projectOption.slug}`}
class="link"
class:active={page.url.pathname.includes(projectOption.slug)}
on:click={() => {
trackEvent(`click_menu_${projectOption.slug}`);
sideBarIsOpen = false;
}}
><span class="link-icon"
><Icon icon={projectOption.icon} size="s" />
</span><span
class:no-text={state === 'icons'}
class:has-text={state === 'open'}
class="link-text">{projectOption.name}</span
></a>
<span slot="tooltip">{projectOption.name}</span>
</Tooltip>
{/each}
{/if}
<div class="only-mobile divider">
<Divider />
</div>
Expand Down
4 changes: 4 additions & 0 deletions src/lib/stores/billing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ export const roles = [
{
label: 'Billing',
value: 'billing'
},
{
label: 'Designer',
value: 'designer'
}
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
{
label: 'Billing',
value: 'billing'
},
{
label: 'Designer',
value: 'designer'
}
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { Menu } from '$lib/components/menu';
import SubMenu from '$lib/components/menu/subMenu.svelte';
import { Button } from '$lib/elements/forms';
import { canWriteSites } from '$lib/stores/roles';
import { sdk } from '$lib/stores/sdk';
import { DeploymentDownloadType, type Models } from '@appwrite.io/console';
import {
Expand Down Expand Up @@ -54,6 +55,7 @@
{#if !inCard}
<ActionMenu.Item.Button
leadingIcon={IconRefresh}
disabled={!$canWriteSites}
on:click={(e) => {
e.preventDefault();
selectedDeployment = deployment;
Expand Down Expand Up @@ -120,6 +122,7 @@
{#if deployment.status !== 'building' && deployment.status !== 'processing' && deployment?.status !== 'waiting'}
<ActionMenu.Item.Button
status="danger"
disabled={!$canWriteSites}
leadingIcon={IconTrash}
on:click={(e) => {
e.preventDefault();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import { ParsedTagList, QuickFilters } from '$lib/components/filters';
import { page } from '$app/state';
import { ConnectRepoModal } from '$lib/components/git';
import { canWriteSites } from '$lib/stores/roles.js';

export let data;

Expand Down Expand Up @@ -90,7 +91,7 @@
<ViewSelector view={View.Table} {columns} hideView />
{/if}
<Popover padding="none" let:toggle>
<Button size="s" on:click={toggle}>
<Button size="s" disabled={!$canWriteSites} on:click={toggle}>
<Icon size="s" icon={IconPlus} />
Create deployment
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import { invalidate } from '$app/navigation';
import { Dependencies } from '$lib/constants';
import { page } from '$app/state';
import { canWriteSites } from '$lib/stores/roles';

let { data } = $props();

Expand Down Expand Up @@ -54,7 +55,7 @@
</Button>
{/if}

<Button secondary on:click={() => (showRedeploy = true)}>Redeploy</Button>
<Button secondary disabled={!$canWriteSites} on:click={() => (showRedeploy = true)}>Redeploy</Button>
<DeploymentActionMenu
inCard
{deployment}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import { app } from '$lib/stores/app';
import { Click, trackEvent } from '$lib/actions/analytics';
import Table from './table.svelte';
import { canWriteRules } from '$lib/stores/roles.js';

export let data;
</script>
Expand All @@ -18,6 +19,7 @@
<Layout.Stack direction="row" justifyContent="space-between">
<SearchQuery placeholder="Search domain" />
<Button
disabled={!$canWriteRules}
href={`${base}/project-${page.params.project}/sites/site-${page.params.site}/domains/add-domain`}
on:click={() => {
trackEvent(Click.DomainCreateClick, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import DeleteDomainModal from './deleteDomainModal.svelte';
import RetryDomainModal from './retryDomainModal.svelte';
import { columns } from './store';
import { canWriteRules } from '$lib/stores/roles';

let {
domains
Expand Down Expand Up @@ -93,6 +94,7 @@
<ActionMenu.Item.Button
status="danger"
leadingIcon={IconTrash}
disabled={!$canWriteRules}
on:click={(e) => {
selectedDomain = domain;
showDelete = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import { Card, Trim } from '$lib/components';
import { Click, trackEvent } from '$lib/actions/analytics';
import { RuleTrigger } from '$lib/stores/sdk';
import { canWriteRules } from '$lib/stores/roles';

export let proxyRuleList: Models.ProxyRuleList;

Expand Down Expand Up @@ -51,6 +52,7 @@
<div>
<Button
secondary
disabled={!$canWriteRules}
size="s"
on:click={() => {
trackEvent(Click.DomainCreateClick, {
Expand Down
Loading