< Summary

Information
Class: locations-list.tsx
Assembly: app.components.locations
File(s): /home/runner/work/ClutterStock/ClutterStock/frontend/app/components/locations/locations-list.tsx
Tag: 58_25416222083
Line coverage
0%
Covered lines: 0
Uncovered lines: 8
Coverable lines: 8
Total lines: 57
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 4
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

File(s)

/home/runner/work/ClutterStock/ClutterStock/frontend/app/components/locations/locations-list.tsx

#LineLine coverage
 1import { Form, Link } from "react-router";
 2import type { LocationResponse } from "~/api/client";
 3
 04export function LocationsList({ locations }: { locations: LocationResponse[] }) {
 05  if (locations.length === 0) {
 06    return (
 7      <div className="card-empty">
 8        <p className="text-muted">No locations yet.</p>
 9        <Link to="/locations/new" className="link-text" style={{ display: "inline-block", marginTop: 12 }}>
 10          Add your first location →
 11        </Link>
 12      </div>
 13    );
 14  }
 15
 016  return (
 17    <table className="console-table">
 18      <thead>
 19        <tr>
 20          <th>Name</th>
 21          <th>Description</th>
 22          <th style={{ width: 1, whiteSpace: "nowrap" }}></th>
 23        </tr>
 24      </thead>
 25      <tbody>
 026        {locations.map((loc) => (
 027          <tr key={loc.id}>
 28            <td>
 29              <span style={{ fontWeight: 500 }}>{loc.name ?? "Unnamed"}</span>
 30            </td>
 31            <td style={{ color: "var(--c-fg-3)", fontSize: 12 }}>
 32              {loc.description || "—"}
 33            </td>
 34            <td>
 35              <div style={{ display: "flex", alignItems: "center", gap: 6 }}>
 36                <Link to={`/locations/${loc.id}/rooms`} className="link-chip">Rooms</Link>
 37                <Link to={`/locations/${loc.id}/edit`} className="link-chip">Edit</Link>
 38                <Form
 39                  method="post"
 040                  onSubmit={(e) => {
 041                    if (!confirm("Delete this location and all its rooms and items?")) e.preventDefault();
 42                  }}
 43                >
 44                  <input type="hidden" name="_action" value="delete" />
 45                  <input type="hidden" name="id" value={loc.id} />
 46                  <button type="submit" className="link-chip" style={{ color: "var(--c-danger)", borderColor: "transpare
 47                    Delete
 48                  </button>
 49                </Form>
 50              </div>
 51            </td>
 52          </tr>
 53        ))}
 54      </tbody>
 55    </table>
 56  );
 57}