import { Link } from "react-router-dom";

import { usePortalSession } from "../context/PortalSessionContext";

export function DashboardPage() {
  const { tenantContext } = usePortalSession();
  if (!tenantContext) {
    return null;
  }

  return (
    <section className="dashboard-page">
      <div className="page-head">
        <h1 className="page-heading">Strumenti</h1>
        <p className="page-subheading">
          Tool operativi del locale. Da qui accedi a tutto quello che serve per la gestione quotidiana.
        </p>
      </div>

      <div className="tool-grid">
        <Link to="/inventory" className="tool-card">
          <div className="tool-card-icon">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={1.5} strokeLinecap="round" strokeLinejoin="round">
              <path d="M3 7.5l9-4 9 4" />
              <path d="M3 7.5v9l9 4 9-4v-9" />
              <path d="M3 7.5l9 4 9-4" />
              <path d="M12 11.5v9" />
            </svg>
          </div>
          <div className="tool-card-body">
            <strong>Inventario</strong>
            <p>
              Crea i magazzini del locale e carica la merce in stock sommando cartoni e bottiglie nello stesso totale.
            </p>
          </div>
          <span className="tool-card-arrow">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
              <path d="M9 5l7 7-7 7" />
            </svg>
          </span>
        </Link>

        <Link to="/fiscal-documents" className="tool-card">
          <div className="tool-card-icon">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={1.5} strokeLinecap="round" strokeLinejoin="round">
              <path d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z" />
              <path d="M9 13h6m-6 4h4" />
            </svg>
          </div>
          <div className="tool-card-body">
            <strong>Documenti fiscali</strong>
            <p>
              Carica fatture e bolle, archiviali per fornitore e prepara il confronto con ordini e pagamenti.
            </p>
          </div>
          <span className="tool-card-arrow">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
              <path d="M9 5l7 7-7 7" />
            </svg>
          </span>
        </Link>
      </div>
    </section>
  );
}
