Full CRM rebuild with Next.js 15, TypeScript, Tailwind, Drizzle ORM, PostgreSQL, Redis, BullMQ, MinIO, and Socket.io. Includes 461 source files covering clients, berths, interests/pipeline, documents/EOI, expenses/invoices, email, notifications, dashboard, admin, and client portal. CI/CD via Gitea Actions with Docker builds. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
32 lines
816 B
TypeScript
32 lines
816 B
TypeScript
'use client';
|
|
|
|
import { useUIStore } from '@/stores/ui-store';
|
|
import { usePortContext } from '@/providers/port-provider';
|
|
import type { Port } from '@/lib/db/schema/ports';
|
|
|
|
interface UsePortReturn {
|
|
currentPort: Port | null;
|
|
currentPortId: string | null;
|
|
currentPortSlug: string | null;
|
|
ports: Port[];
|
|
setPort: (portId: string, portSlug: string) => void;
|
|
}
|
|
|
|
/**
|
|
* Hook to get current port context from Zustand store and PortContext.
|
|
*/
|
|
export function usePort(): UsePortReturn {
|
|
const { currentPort, ports } = usePortContext();
|
|
const currentPortId = useUIStore((s) => s.currentPortId);
|
|
const currentPortSlug = useUIStore((s) => s.currentPortSlug);
|
|
const setPort = useUIStore((s) => s.setPort);
|
|
|
|
return {
|
|
currentPort,
|
|
currentPortId,
|
|
currentPortSlug,
|
|
ports,
|
|
setPort,
|
|
};
|
|
}
|