Home / File/ notes.tsx — ui Source File

notes.tsx — ui Source File

Architecture documentation for notes.tsx, a tsx file in the ui codebase. 5 imports, 0 dependents.

File tsx FrameworkTooling CLICore 5 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  a6b12f74_f95d_2ab0_e271_ed25f8e49373["notes.tsx"]
  ce9dd226_41a3_f031_caf3_5378288c23c1["node"]
  a6b12f74_f95d_2ab0_e271_ed25f8e49373 --> ce9dd226_41a3_f031_caf3_5378288c23c1
  b969017e_0ead_3c70_277e_2e4416d7a8ed["react"]
  a6b12f74_f95d_2ab0_e271_ed25f8e49373 --> b969017e_0ead_3c70_277e_2e4416d7a8ed
  81280df8_e680_3b0f_f449_ef98289c6f1f["note.server"]
  a6b12f74_f95d_2ab0_e271_ed25f8e49373 --> 81280df8_e680_3b0f_f449_ef98289c6f1f
  a16e75e5_8d49_95a1_3e98_b347fb9dbfb5["session.server"]
  a6b12f74_f95d_2ab0_e271_ed25f8e49373 --> a16e75e5_8d49_95a1_3e98_b347fb9dbfb5
  f7a8c102_dd23_93be_c89e_8d95a5739b59["utils"]
  a6b12f74_f95d_2ab0_e271_ed25f8e49373 --> f7a8c102_dd23_93be_c89e_8d95a5739b59
  style a6b12f74_f95d_2ab0_e271_ed25f8e49373 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { LoaderFunctionArgs } from "@remix-run/node";
import { json } from "@remix-run/node";
import { Form, Link, NavLink, Outlet, useLoaderData } from "@remix-run/react";

import { getNoteListItems } from "~/models/note.server";
import { requireUserId } from "~/session.server";
import { useUser } from "~/utils";

export const loader = async ({ request }: LoaderFunctionArgs) => {
  const userId = await requireUserId(request);
  const noteListItems = await getNoteListItems({ userId });
  return json({ noteListItems });
};

export default function NotesPage() {
  const data = useLoaderData<typeof loader>();
  const user = useUser();

  return (
    <div className="flex h-full min-h-screen flex-col">
      <header className="flex items-center justify-between bg-slate-800 p-4 text-white">
        <h1 className="text-3xl font-bold">
          <Link to="">Notes</Link>
        </h1>
        <p>{user.email}</p>
        <Form action="/logout" method="post">
          <button
            type="submit"
            className="rounded bg-slate-600 px-4 py-2 text-blue-100 hover:bg-blue-500 active:bg-blue-600"
          >
            Logout
          </button>
        </Form>
      </header>

      <main className="flex h-full bg-white">
        <div className="h-full w-80 border-r bg-gray-50">
          <Link to="new" className="block p-4 text-xl text-blue-500">
            + New Note
          </Link>

          <hr />

          {data.noteListItems.length === 0 ? (
            <p className="p-4">No notes yet</p>
          ) : (
            <ol>
              {data.noteListItems.map((note) => (
                <li key={note.id}>
                  <NavLink
                    className={({ isActive }) =>
                      `block border-b p-4 text-xl ${isActive ? "bg-white" : ""}`
                    }
                    to={note.id}
                  >
                    📝 {note.title}
                  </NavLink>
                </li>
              ))}
            </ol>
          )}
        </div>

        <div className="flex-1 p-6">
          <Outlet />
        </div>
      </main>
    </div>
  );
}

Subdomains

Dependencies

  • node
  • note.server
  • react
  • session.server
  • utils

Frequently Asked Questions

What does notes.tsx do?
notes.tsx is a source file in the ui codebase, written in tsx. It belongs to the FrameworkTooling domain, CLICore subdomain.
What functions are defined in notes.tsx?
notes.tsx defines 2 function(s): NotesPage, loader.
What does notes.tsx depend on?
notes.tsx imports 5 module(s): node, note.server, react, session.server, utils.
Where is notes.tsx in the architecture?
notes.tsx is located at packages/shadcn/test/fixtures/frameworks/remix-indie-stack/app/routes/notes.tsx (domain: FrameworkTooling, subdomain: CLICore, directory: packages/shadcn/test/fixtures/frameworks/remix-indie-stack/app/routes).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free