HEX
Server: Apache
System: Linux p3plzcpnl506847.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: slfopp7cb1df (5698090)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/slfopp7cb1df/public_html/sitepacket.com/src/editor/src/components/artboard-menu.svelte
<script>
  import { store, getters } from 'Editor/store'
  import { activeArtboard } from 'Editor/store/ui'
  import FormControl from 'Editor/components/UI/form-controls/form-control'
  import { onDestroy } from 'svelte'

  let subscribers = []
  let options = []

  update()

  subscribers.push(
    store.subscribe(() => {
      update()
    })
  )

  onDestroy(() => {
    subscribers.forEach((unsub) => unsub())
    subscribers = []
  })

  function update() {
    let artboards = getters.getArtboards()

    // Generate options for the select
    options = artboards.map((o) => {
      return { name: o.title, value: o.id }
    })

    // Check if there is no active artboard set
    if (!$activeArtboard) {
      $activeArtboard = artboards[0].id
    } else {
      // Check if the active artboard exists in the store
      if (options.filter((o) => o.value === $activeArtboard).length === 0) $activeArtboard = artboards[0].id
    }
  }
</script>

<div class="flex z-10 absolute -left-1 -top-10 min-w-[120px]">
  <div class="flex-1"><FormControl type="select" {options} bind:value={$activeArtboard} /></div>
</div>