App hub

Your product in the middle, lit from behind, wired to six apps on dark tiles around it. The wires draw themselves in and a light keeps running down each one.

designs.here
  • Ask an agent

  • Open in Figma

  • Paste into code

  • Push to a repo

  • Preview it live

  • Share with the team

Marks from Simple Icons, used under the MIT licence.

Options

Screen
Colour

Code

import { useLayoutEffect, useRef, useState } from "react";
import "./app-hub.css";

/* The marks are from Simple Icons. Any svg that takes the text colour works. */
const defaults = [
  { name: "Claude", label: "Ask an agent", mark: <svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z"/></svg> },
  { name: "Figma", label: "Open in Figma", mark: <svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M15.852 8.981h-4.588V0h4.588c2.476 0 4.49 2.014 4.49 4.49s-2.014 4.491-4.49 4.491zM12.735 7.51h3.117c1.665 0 3.019-1.355 3.019-3.019s-1.355-3.019-3.019-3.019h-3.117V7.51zm0 1.471H8.148c-2.476 0-4.49-2.014-4.49-4.49S5.672 0 8.148 0h4.588v8.981zm-4.587-7.51c-1.665 0-3.019 1.355-3.019 3.019s1.354 3.02 3.019 3.02h3.117V1.471H8.148zm4.587 15.019H8.148c-2.476 0-4.49-2.014-4.49-4.49s2.014-4.49 4.49-4.49h4.588v8.98zM8.148 8.981c-1.665 0-3.019 1.355-3.019 3.019s1.355 3.019 3.019 3.019h3.117V8.981H8.148zM8.172 24c-2.489 0-4.515-2.014-4.515-4.49s2.014-4.49 4.49-4.49h4.588v4.441c0 2.503-2.047 4.539-4.563 4.539zm-.024-7.51a3.023 3.023 0 0 0-3.019 3.019c0 1.665 1.365 3.019 3.044 3.019 1.705 0 3.093-1.376 3.093-3.068v-2.97H8.148zm7.704 0h-.098c-2.476 0-4.49-2.014-4.49-4.49s2.014-4.49 4.49-4.49h.098c2.476 0 4.49 2.014 4.49 4.49s-2.014 4.49-4.49 4.49zm-.097-7.509c-1.665 0-3.019 1.355-3.019 3.019s1.355 3.019 3.019 3.019h.098c1.665 0 3.019-1.355 3.019-3.019s-1.355-3.019-3.019-3.019h-.098z"/></svg> },
  { name: "Zed", label: "Paste into code", mark: <svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M2.25 1.5a.75.75 0 0 0-.75.75v16.5H0V2.25A2.25 2.25 0 0 1 2.25 0h20.095c1.002 0 1.504 1.212.795 1.92L10.764 14.298h3.486V12.75h1.5v1.922a1.125 1.125 0 0 1-1.125 1.125H9.264l-2.578 2.578h11.689V9h1.5v9.375a1.5 1.5 0 0 1-1.5 1.5H5.185L2.562 22.5H21.75a.75.75 0 0 0 .75-.75V5.25H24v16.5A2.25 2.25 0 0 1 21.75 24H1.655C.653 24 .151 22.788.86 22.08L13.19 9.75H9.75v1.5h-1.5V9.375A1.125 1.125 0 0 1 9.375 8.25h5.314l2.625-2.625H5.625V15h-1.5V5.625a1.5 1.5 0 0 1 1.5-1.5h13.19L21.438 1.5z"/></svg> },
  { name: "GitHub", label: "Push to a repo", mark: <svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg> },
  { name: "Chrome", label: "Preview it live", mark: <svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 0C8.21 0 4.831 1.757 2.632 4.501l3.953 6.848A5.454 5.454 0 0 1 12 6.545h10.691A12 12 0 0 0 12 0zM1.931 5.47A11.943 11.943 0 0 0 0 12c0 6.012 4.42 10.991 10.189 11.864l3.953-6.847a5.45 5.45 0 0 1-6.865-2.29zm13.342 2.166a5.446 5.446 0 0 1 1.45 7.09l.002.001h-.002l-5.344 9.257c.206.01.413.016.621.016 6.627 0 12-5.373 12-12 0-1.54-.29-3.011-.818-4.364zM12 16.364a4.364 4.364 0 1 1 0-8.728 4.364 4.364 0 0 1 0 8.728Z"/></svg> },
  { name: "Discord", label: "Share with the team", mark: <svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"/></svg> },
];

/* Works out the wires from where the tiles really are. */
function wires(map) {
  const box = (node) => {
    let x = 0;
    let y = 0;
    for (let at = node; at && at !== map; at = at.offsetParent) {
      x += at.offsetLeft;
      y += at.offsetTop;
    }
    return { x, y };
  };
  const hub = map.querySelector(".dh-hub-logo");
  const s = hub.offsetWidth;
  const mid = box(hub).x + s / 2;
  const top = box(hub).y + s / 2;
  const n = (value) => value.toFixed(1);
  const path = (a, b, c, d) => "M" + n(a[0]) + " " + n(a[1]) + "C" + n(b[0]) + " " + n(b[1]) + " " + n(c[0]) + " " + n(c[1]) + " " + n(d[0]) + " " + n(d[1]);
  return [...map.querySelectorAll(".dh-hub-tile")].map((tile, i) => {
    const column = i % 3;
    const side = column === 0 ? -1 : 1;
    const x = box(tile).x + s / 2;
    const y = box(tile).y + s * 0.03;
    /* The outer two of the first row: one wide sweep out from the hub's shoulder. */
    if (i < 3 && column !== 1) {
      const from = [mid + side * s * 0.48, top - s * 0.22];
      return path(from, [mid + side * s * 1.25, top + s * 0.12], [x - side * s * 0.02, y - s * 0.95], [x - side * s * 0.08, y]);
    }
    /* The middle of the first row: a loop out to the left and back. */
    if (i < 3) {
      const from = [mid - s * 0.47, top - s * 0.05];
      return path(from, [mid - s * 1.02, top + s * 0.62], [mid - s * 0.86, top + s * 1.22], [x - s * 0.38, y]);
    }
    /* The outer two of the second row: almost straight, down through the gaps between columns. */
    if (column !== 1) {
      const from = [mid + side * s * 0.46, top + s * 0.4];
      const to = [x - side * s * 0.42, y + s * 0.03];
      const drop = to[1] - from[1];
      return path(from, [from[0] + side * s * 0.1, from[1] + drop * 0.34], [to[0] - side * s * 0.14, to[1] - drop * 0.3], to);
    }
    /* The middle of the second row: a big arc round the right of the tile above it. */
    const from = [mid + s * 0.49, top + s * 0.06];
    const to = [x + s * 0.5, y + s * 0.1];
    return path(from, [mid + s * 1.55, top + s * 1.25], [mid + s * 1.6, to[1] - s * 0.95], to);
  });
}

export function AppHub({ name = "designs.here", logo = "/blocks/dock-designs.svg", apps = defaults }) {
  const map = useRef(null);
  const [paths, setPaths] = useState([]);
  const [on, setOn] = useState(-1);
  useLayoutEffect(() => {
    const draw = () => setPaths(wires(map.current));
    draw();
    const observer = new ResizeObserver(draw);
    observer.observe(map.current);
    return () => observer.disconnect();
  }, [apps.length]);
  return (
    <section className="dh-hub">
      <div className="dh-hub-map" ref={map}>
        <svg className="dh-hub-wires" aria-hidden="true">
          {paths.map((d, i) => [
            <path key={"wire" + i} className="dh-hub-wire" pathLength="1" d={d} data-on={i === on ? "" : undefined} />,
            <path key={"spark" + i} className="dh-hub-spark" pathLength="1" d={d} style={{ animationDelay: 1.2 + i * 0.55 + "s" }} />,
          ])}
        </svg>
        <div className="dh-hub-core">
          <span className="dh-hub-logo">
            <img src={logo} alt="" width="120" height="120" />
          </span>
          <strong>{name}</strong>
        </div>
        <ul className="dh-hub-apps">
          {apps.map((app, i) => (
            <li key={app.name} onPointerEnter={() => setOn(i)} onPointerLeave={() => setOn(-1)}>
              <span className="dh-hub-tile" role="img" aria-label={app.name}>
                {app.mark}
              </span>
              <p>{app.label}</p>
            </li>
          ))}
        </ul>
      </div>
    </section>
  );
}
designs.here
  • Ask an agent

  • Open in Figma

  • Paste into code

  • Push to a repo

  • Preview it live

  • Share with the team