Skip to content

Latest commit

 

History

History
67 lines (60 loc) · 7.55 KB

File metadata and controls

67 lines (60 loc) · 7.55 KB

�� � ������� fullstack-�����������. �������� � ������� LifeScript (Next.js App Router + TypeScript + Tailwind + shadcn/ui + Prisma + Neon/Postgres + Auth).

������ ������ ������� �������� LifeScript: ��� ������� �� ������� ��������� �������:

  1. ����� � ���������� �� createdAt desc
  2. ���������� � ���������� �� ���������� ������ desc �� ������� ���������� ������ PUBLIC ������. ��� ����������� ������ ������ ������� (���������/�������������/�������/����������� private/public). ����� ����� ������ �������� � (���� �� ����������� �������) ������� � �� ��������������/CRUD ������ ���������.

���������� � UI

  • ������� ���� (Header):
    • ����/�������� ProStore (������ �� �/�)
    • ���������: �������, �������, ��� ������
    • ������: ������ �����/����� (� ����������� �� ������), ����-������, ��� (���� ����)
  • ������ ���� (Footer):
    • �������� �����: (�) LifeScript + ���
    • ������: ��������, ��������
  • ������� ��������:
    • Hero-����: ��������� + ������������ + ������ ��������� �����
      • ���� �� �����������: ������ ���� �� /auth/signin (��� ��� ���� ������) � ������������ ��������� ��������, ����� ����������
    • ��� ����� �������:
      • ������ (��������� 10�20)
      • ����������� (��� 10�20 �� likesCount)
    • �������� ������ � ������:
      • ���������, ����� (���), ����
      • ���� (���� ����)
      • ������ ��������� (�� �������� ������ /prompts/[id])
      • ������� ������ + ������ ����� (���� ����� ��� �����������)
      • ������� ������ ��������������/�������� �� �������
  • ������������: ������� �� ���������.

���������� � ������

  • ������ 2 ������� � �� (��� ���� � ����� ���������) ����� Prisma:
    • recentPrompts: where { isPublic: true } orderBy { createdAt: "desc" } take N
    • popularPrompts: where { isPublic: true } orderBy �� likesCount desc take N
  • ��� ������ ������ likesCount ����� Prisma _count (��� ������� ����������� ����).
  • ���� ������������ ����������� � ��� ������ �������� ������ likedByMe (����� ��� ��������� ������ �����).
    • �������� ��� ����������: ���� ������ �� promptIds � ������� Like, ����� ���� Set(promptId).

�����������

  • ������ ����� Layout:
    • app/layout.tsx � �������� Header/Footer
    • Header/Footer ��� ��������� ���������� � components/layout/
  • ������� ��������:
    • app/page.tsx � Server Component
    • �������� session (���� ����) � ������ �� Prisma
    • �������� ��� ������
  • ����������:
    • PromptCard (server-safe ��� client-only ��������)
    • LikeButton � client component (���� ����� ����)
    • Sort/������������� �� ������� �� �����: ��� ��� ������������� �������.

����� �������

  • ��������/��������������/�������� ������� � ������������� private/public ������ ���� �������� ������ �������������� ������������� �� ��������������� ��������� (�������� /my).
  • �� ������� � � ��������� �������� �������� ��������������.
  • ���� �� ������� ���� �������� �������������� � ������ guard: ���� ��� session > redirect �� login ��� 403.

��� ����� �������

  1. �������� Header/Footer � �������� � ����� layout.
  2. �������� ������� �������� � ����� �������� ������ � �����������.
  3. ������� ������ �� Prisma: public prompts + likesCount (+likedByMe ��� ������� ������).
  4. �������, ��� ����� �� ����� ������ �������������� � �� ����� ������� �������� �������������� ��������.
  5. ������ ������ ���������� ������ � �������� ��������� ����.

����������

  • ��������� shadcn/ui ����������: Card, Button, Badge, Separator, DropdownMenu (��� �������), Skeleton (�����������).
  • �� ����� ������������ ����������.
  • ���� ��������� ������ ���������� (�������� ���� public ���������� visibility), ������� ����� ���������� �������� � prisma.schema � �������� ���.