<script>
  import { t } from './i18n'

  function wailsCall(method, ...args) {
    try {
      if (window['go'] && window['go']['main'] && window['go']['main']['App']) {
        const fn = window['go']['main']['App'][method]
        if (typeof fn === 'function') return fn(...args)
      }
    } catch (e) { console.error('Wails error:', method, e) }
    return Promise.reject(new Error('Wails not connected: ' + method))
  }

  async function openPluginsDir() {
    try { await wailsCall('OpenPluginsFolder') } catch(e) {}
  }
</script>

<div class="settings-section">
  <h2>{t('settings.plugins')}</h2>
  <p class="section-desc">{t('settings.noPlugins')}</p>
  <button class="btn" on:click={openPluginsDir}>{t('settings.openPluginsDir')}</button>
</div>

<style>
  .settings-section { padding: 1.5rem; max-width: 500px; }
  .settings-section h2 { margin: 0 0 0.5rem 0; font-size: 1.2rem; color: var(--text, #e0e0e0); }
  .section-desc { color: var(--text-dim, #888); font-size: 0.85rem; margin-bottom: 1rem; }
</style>
