Fix creators being unable to click on apps they have non-creator access to

This commit is contained in:
Andrew Kingston 2024-02-09 13:04:30 +00:00
parent 34edf19965
commit 9109681bbe
1 changed files with 11 additions and 4 deletions

View File

@ -11,6 +11,7 @@
$: editing = app.sessions?.length $: editing = app.sessions?.length
$: isBuilder = sdk.users.isBuilder($auth.user, app?.devId) $: isBuilder = sdk.users.isBuilder($auth.user, app?.devId)
$: unclickable = !isBuilder && !app.deployed
const handleDefaultClick = () => { const handleDefaultClick = () => {
if (!isBuilder) { if (!isBuilder) {
@ -31,11 +32,17 @@
} }
const goToApp = () => { const goToApp = () => {
window.open(`/app/${app.name}`, "_blank") if (app.deployed && app.url) {
window.open(`/app${app.url}`, "_blank")
}
} }
</script> </script>
<div class="app-row" on:click={lockedAction || handleDefaultClick}> <div
class="app-row"
on:click={lockedAction || handleDefaultClick}
class:unclickable
>
<div class="title"> <div class="title">
<div class="app-icon"> <div class="app-icon">
<Icon size="L" name={app.icon?.name || "Apps"} color={app.icon?.color} /> <Icon size="L" name={app.icon?.name || "Apps"} color={app.icon?.color} />
@ -74,7 +81,7 @@
Edit Edit
</Button> </Button>
</div> </div>
{:else} {:else if app.deployed}
<!-- this can happen if an app builder has app user access to an app --> <!-- this can happen if an app builder has app user access to an app -->
<div class="app-row-actions"> <div class="app-row-actions">
<Button size="S" secondary>View</Button> <Button size="S" secondary>View</Button>
@ -94,7 +101,7 @@
transition: border 130ms ease-out; transition: border 130ms ease-out;
border: 1px solid transparent; border: 1px solid transparent;
} }
.app-row:hover { .app-row:not(.unclickable):hover {
cursor: pointer; cursor: pointer;
border-color: var(--spectrum-global-color-gray-300); border-color: var(--spectrum-global-color-gray-300);
} }