Viktorani API - v0.0.8
    Preparing search index...
    • Manages question-visibility state for the GM view.

      Parameters

      • game: Game

        The active game. Initial visibility values are read from this record.

      Returns UseGameVisibilityResult

      The GM can independently reveal the question text, answer options, and associated media to players. Each toggle is persisted to the games table and broadcast via the VISIBILITY transport event so all connected players update immediately.

      Optimistic updates are applied locally before the DB write completes. If the write fails, the previous state is restored and error is set.

      function VisibilityPanel({ game }: { game: Game }) {
      const { visibility, toggle, saving } = useGameVisibility(game)
      return (
      <button onClick={() => toggle('showQuestion')} disabled={saving}>
      {visibility.showQuestion ? 'Hide' : 'Show'} Question
      </button>
      )
      }