83 lines
1.7 KiB
Svelte
83 lines
1.7 KiB
Svelte
<script>
|
|
import {
|
|
Heading,
|
|
Icon,
|
|
Body,
|
|
Layout,
|
|
ActionMenu,
|
|
MenuItem,
|
|
Link,
|
|
notifications,
|
|
} from "@budibase/bbui"
|
|
import download from "downloadjs"
|
|
import { gradient } from "actions"
|
|
|
|
export let name
|
|
export let _id
|
|
|
|
let appExportLoading = false
|
|
|
|
async function exportApp() {
|
|
appExportLoading = true
|
|
try {
|
|
download(
|
|
`/api/backups/export?appId=${_id}&appname=${encodeURIComponent(name)}`
|
|
)
|
|
notifications.success("App export complete")
|
|
} catch (err) {
|
|
console.error(err)
|
|
notifications.error("App export failed")
|
|
} finally {
|
|
appExportLoading = false
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<Layout noPadding gap="XS">
|
|
<div class="preview" use:gradient />
|
|
<div class="title">
|
|
<Link href={`/builder/app/${_id}`}>
|
|
<Heading size="XS">
|
|
{name}
|
|
</Heading>
|
|
</Link>
|
|
<ActionMenu>
|
|
<Icon slot="control" name="More" hoverable />
|
|
<MenuItem on:click={exportApp} icon="Download">Export</MenuItem>
|
|
</ActionMenu>
|
|
</div>
|
|
<div class="status">
|
|
<Body noPadding size="S">
|
|
Edited {Math.floor(1 + Math.random() * 10)} months ago
|
|
</Body>
|
|
{#if Math.random() > 0.5}
|
|
<Icon name="LockClosed" />
|
|
{/if}
|
|
</div>
|
|
</Layout>
|
|
|
|
<style>
|
|
.preview {
|
|
height: 135px;
|
|
border-radius: var(--border-radius-s);
|
|
margin-bottom: var(--spacing-s);
|
|
}
|
|
|
|
.title,
|
|
.status {
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
|
|
.title :global(a) {
|
|
text-decoration: none;
|
|
}
|
|
.title :global(h1:hover) {
|
|
color: var(--spectrum-global-color-blue-600);
|
|
cursor: pointer;
|
|
transition: color 130ms ease;
|
|
}
|
|
</style>
|