#!/usr/bin/env bash
set -euo pipefail

ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
LAYOUT_FILE="$ROOT_DIR/common/shell/layout.ts"

fail() {
  echo "ERROR: $*" >&2
  exit 1
}

assert_contains() {
  local pattern="$1"
  grep -Fq -- "$pattern" "$LAYOUT_FILE" || fail "common shell layout must contain: $pattern"
}

assert_not_contains() {
  local pattern="$1"
  if grep -Fq -- "$pattern" "$LAYOUT_FILE"; then
    fail "common shell layout must not contain: $pattern"
  fi
}

assert_contains "root: \"grid min-h-screen grid-cols-[240px,minmax(0,1fr)]"
assert_not_contains "md:grid-cols-[240px,1fr]"
assert_contains "aside:"
assert_contains "sticky top-0 h-screen"
assert_not_contains "border-b border-border bg-card md:sticky"

echo "OK: shell layout keeps the navigation in a fixed left column"
