Add warning banner for old screens and allow updating screens to remove custom layouts

This commit is contained in:
Andrew Kingston 2022-04-27 15:47:59 +01:00
parent 17efdeb824
commit a4b6b3e1e3
2 changed files with 41 additions and 16 deletions

View File

@ -8,6 +8,7 @@
export let size = "S" export let size = "S"
export let extraButtonText export let extraButtonText
export let extraButtonAction export let extraButtonAction
export let showCloseButton = true
let show = true let show = true
@ -39,22 +40,24 @@
</button> </button>
{/if} {/if}
</div> </div>
<div class="spectrum-Toast-buttons"> {#if showCloseButton}
<button <div class="spectrum-Toast-buttons">
class="spectrum-ClearButton spectrum-ClearButton--overBackground spectrum-ClearButton--size{size}" <button
on:click={clear} class="spectrum-ClearButton spectrum-ClearButton--overBackground spectrum-ClearButton--size{size}"
> on:click={clear}
<div class="spectrum-ClearButton-fill"> >
<svg <div class="spectrum-ClearButton-fill">
class="spectrum-ClearButton-icon spectrum-Icon spectrum-UIIcon-Cross100" <svg
focusable="false" class="spectrum-ClearButton-icon spectrum-Icon spectrum-UIIcon-Cross100"
aria-hidden="true" focusable="false"
> aria-hidden="true"
<use xlink:href="#spectrum-css-icon-Cross100" /> >
</svg> <use xlink:href="#spectrum-css-icon-Cross100" />
</div> </svg>
</button> </div>
</div> </button>
</div>
{/if}
</div> </div>
{/if} {/if}
@ -63,4 +66,8 @@
pointer-events: all; pointer-events: all;
width: 100%; width: 100%;
} }
.spectrum-Button {
border: 1px solid rgba(255, 255, 255, 0.2);
margin: 8px 0 4px 0;
}
</style> </style>

View File

@ -8,6 +8,7 @@
Button, Button,
Toggle, Toggle,
Checkbox, Checkbox,
Banner,
notifications, notifications,
} from "@budibase/bbui" } from "@budibase/bbui"
import PropertyControl from "components/design/settings/controls/PropertyControl.svelte" import PropertyControl from "components/design/settings/controls/PropertyControl.svelte"
@ -128,6 +129,13 @@
}, },
}, },
] ]
const removeCustomLayout = async () => {
let screen = get(selectedScreen)
screen.layoutId = null
screen.showNavigation = true
await store.actions.screens.save(screen)
}
</script> </script>
<SettingsPanel <SettingsPanel
@ -135,6 +143,16 @@
icon={$selectedScreen.routing.route === "/" ? "Home" : "WebPage"} icon={$selectedScreen.routing.route === "/" ? "Home" : "WebPage"}
> >
<Layout gap="S" paddingX="L" paddingY="XL"> <Layout gap="S" paddingX="L" paddingY="XL">
{#if $selectedScreen.layoutId}
<Banner
type="warning"
extraButtonText="Update"
extraButtonAction={removeCustomLayout}
showCloseButton={false}
>
This screen uses a custom layout, which is deprecated
</Banner>
{/if}
{#each screenSettings as setting (setting.key)} {#each screenSettings as setting (setting.key)}
<PropertyControl <PropertyControl
control={setting.control} control={setting.control}