Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions docs/engineering/domain-model-realignment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Naruon Domain Model Realignment

## Overview
Previous implementations (T-004, T-005, T-006) introduced generic features (`/ai-hub`, `/prompt-studio`, `/settings`) that drifted away from the core UI/UX mocks and created ambiguous bounded contexts for Identity, Tenant configuration, and Self-hosted runner topologies.

This document realigns the Ubiquitous Language and Bounded Contexts.

## Bounded Contexts

### 1. Identity & Organization Context
- **Organization (Workspace):** Represents a corporate entity. Billing and data isolation occur at this level.
- **Organization Admin:** A user with privileges to configure Organization-wide integrations (SSO, Org-wide LLM providers like BYOK, Enterprise Self-hosted runner tokens).
- **Member:** A standard user within an Organization.
- *Previous Error:* "Admin" was used as a generic string across the app without distinguishing System Admin (Naruon SaaS owner) vs. Organization Admin.

### 2. Provider Integration Context (BYOK & LLM)
- **Bring Your Own Key (BYOK):** Organizations can supply their own OpenAI/Anthropic/Gemini keys.
- **Naruon Managed LLM:** A fallback/default if the Organization pays Naruon directly.
- *Previous Error:* The `/settings` UI allowed any user to create "Providers" globally, lacking Workspace/Organization bounding.

### 3. Mailbox Configuration Context
- **Mailbox (Email Account):** Belongs to a Member. A Member can have multiple Mailboxes (e.g., Google, Outlook, Custom IMAP/SMTP).
- *Previous Error:* The app provided no UI for users to configure their IMAP/SMTP credentials.

### 4. Runner Topology Context
- **Self-Hosted Runner (Relay Proxy):** A stateless agent deployed within a corporate intranet to route IMAP/SMTP traffic securely without exposing the intranet to the public internet.
- **Topology:** The runner connects outbound to Naruon (via WebSocket or gRPC tunnel) and routes traffic to the internal Mail Server. It is bound to an Organization.
- *Previous Error:* Runner boundaries were documented but not tied to the Organization context UI.

## Ubiquitous Language & Frontend Nav
The Frontend layout MUST strictly adhere to the provided Figma/UI UX mockups (`frontend/branding/uiux/uiux4.png`).
- **Mail Actions:** 메일 작성
- **Mail Navigation:** 받은 메일, 중요 메일, 보낸 메일, 임시 보관함, 전체 메일
- **AI Hub Navigation (AI 허브 BETA):** 맥락 종합, 판단 포인트, 실행 항목
- **Projects Navigation (프로젝트):** (Dynamic user projects)
- **Labels (라벨):** (Dynamic user labels)
- **Insights (오늘의 인사이트):** 업무 집중 시간 등 하단 위젯

*No "Prompt Studio" or generic "Settings" should replace the core mail navigation layout.* Settings must be accessed via user profile or a dedicated config modal/page, NOT dominating the primary sidebar.

## Action Items
1. Restore `DashboardLayout.tsx` to match `uiux4.png` strictly.
2. Draft proper Organization and User database schemas to fix the identity boundary.
15 changes: 5 additions & 10 deletions frontend/src/components/DashboardLayout.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* @vitest-environment jsdom */
import React, { act } from "react";
import { createRoot, type Root } from "react-dom/client";
import { afterEach, describe, expect, it, vi } from "vitest";

Check warning on line 4 in frontend/src/components/DashboardLayout.test.tsx

View workflow job for this annotation

GitHub Actions / frontend

'vi' is defined but never used

import { DashboardLayout } from "./DashboardLayout";

Expand Down Expand Up @@ -33,7 +33,7 @@

const banner = container.querySelector('header[aria-label="Naruon workspace header"]');
const sidebar = container.querySelector('aside[aria-label="Naruon workspace sidebar"]');
const nav = container.querySelector('nav[aria-label="Naruon workspace sections"]');
const nav = container.querySelector('nav[aria-label="Mail sections"]');
const mobileNav = container.querySelector('nav[aria-label="Mobile workspace sections"]');
const mobileMenuButton = container.querySelector<HTMLButtonElement>('button[aria-label="Open workspace menu"]');
const mobileNavButtons = Array.from(mobileNav?.querySelectorAll('a') ?? []).map(
Expand All @@ -51,19 +51,15 @@
expect(mobileNav).not.toBeNull();
expect(mobileMenuButton?.getAttribute("aria-expanded")).toBe("false");
expect(mobileMenuButton?.getAttribute("aria-controls")).toBe("mobile-workspace-menu");
console.log('MOBILENAV HTML:', mobileNav?.outerHTML);
expect(mobileNavButtons).toEqual(["받은 메일", "AI Hub", "Prompt Studio", "워크스페이스 설정"]);
expect(mobileNavButtons).toEqual(["받은 메일", "중요 메일", "보낸 메일", "임시 보관함", "전체 메일"]);
expect(main).not.toBeNull();
expect(skipLink).not.toBeNull();
expect(logo?.getAttribute("src")).toBe("/brand/naruon-logo.svg");
expect(sidebar?.textContent ?? "").toContain("Naruon");
expect(sidebar?.textContent ?? "").toContain("흐름을 건너, 더 나은 판단과 실행으로.");
expect(nav?.textContent ?? "").toContain("받은 메일");
expect(nav?.textContent ?? "").toContain("AI Hub");
expect(nav?.textContent ?? "").toContain("Prompt Studio");
expect(nav?.textContent ?? "").toContain("워크스페이스 설정");
expect(banner?.textContent ?? "").toContain("캘린더 반영");
expect(banner?.textContent ?? "").toContain("답장 초안");


expect(banner?.textContent ?? "").toContain("할 일 만들기");
expect(skipLink?.textContent).toBe("Skip to main content");
expect(main?.textContent ?? "").toContain("Inbox workspace content");
Expand All @@ -73,7 +69,6 @@
});

expect(mobileMenuButton?.getAttribute("aria-expanded")).toBe("true");
expect(container.querySelector('#mobile-workspace-menu')?.textContent ?? "").toContain("Prompt Studio");
});
});

});
108 changes: 99 additions & 9 deletions frontend/src/components/DashboardLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,39 @@ import {
Search,
Send,
Sparkles,
Settings,
Code,
Star,
Target,
FolderOpen,
TrendingUp,
Edit3
} from 'lucide-react';

const mailNavItems = [
{ label: '받은 메일', description: '우선순위 인박스', icon: Inbox, href: '/' },
{ label: 'AI Hub', description: '최근 요약 및 인사이트', icon: Network, href: '/ai-hub' },
{ label: 'Prompt Studio', description: '프롬프트 테스트 및 관리', icon: Code, href: '/prompt-studio' },
{ label: '워크스페이스 설정', description: 'LLM 및 보안 설정', icon: Settings, href: '/settings' },
{ label: '중요 메일', description: '중요 표시된 메일', icon: Star, href: '/starred' },
{ label: '보낸 메일', description: '발송 완료', icon: Send, href: '/sent' },
{ label: '임시 보관함', description: '작성 중인 메일', icon: FileText, href: '/drafts' },
{ label: '전체 메일', description: '모든 메일함', icon: Home, href: '/all' },
];

const aiHubItems = [
{ label: '맥락 종합', description: '분산된 흐름 통합', icon: Network, href: '/ai-hub/context' },
{ label: '판단 포인트', description: '주요 의사결정 요인', icon: Target, href: '/ai-hub/decisions' },
{ label: '실행 항목', description: '추출된 업무(Action Items)', icon: CheckCircle2, href: '/ai-hub/actions' },
];

const projectItems = [
{ label: '런칭 프로젝트', description: '', icon: FolderOpen, href: '/projects/launch' },
{ label: '벤더 관리', description: '', icon: FolderOpen, href: '/projects/vendor' },
{ label: '마케팅 캠페인', description: '', icon: FolderOpen, href: '/projects/marketing' },
];

const labelItems = [
{ label: '긴급', color: 'bg-red-500', href: '/labels/urgent' },
{ label: '회의', color: 'bg-yellow-500', href: '/labels/meeting' },
{ label: '계약', color: 'bg-green-500', href: '/labels/contract' },
{ label: '디자인', color: 'bg-purple-500', href: '/labels/design' },
{ label: '개발', color: 'bg-blue-500', href: '/labels/dev' },
];

const aiNavItems = [
Expand Down Expand Up @@ -61,7 +83,7 @@ function NavLink({
href = '#main-content',
}: {
label: string;
description: string;
description?: string;
href?: string;
icon: React.ComponentType<{ className?: string; 'aria-hidden'?: boolean }>;
}) {
Expand All @@ -72,7 +94,7 @@ function NavLink({
<Link
href={href}
aria-current={active ? 'page' : undefined}
className={`group flex min-h-11 items-center gap-3 rounded-xl px-3 py-2 text-sm transition-all focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/40 ${
className={`group flex min-h-9 items-center gap-3 rounded-xl px-3 py-2 text-sm transition-all focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/40 ${
active
? 'bg-primary text-primary-foreground shadow-[0_12px_28px_rgba(37,99,255,0.24)]'
: 'text-sidebar-foreground hover:bg-sidebar-accent hover:text-primary'
Expand Down Expand Up @@ -134,13 +156,81 @@ export function DashboardLayout({
</div>
</div>

<nav aria-label="Naruon workspace sections" className="mt-6 space-y-1.5">
<p className="px-3 text-[11px] font-bold uppercase tracking-[0.18em] text-muted-foreground">워크스페이스</p>
<div className="px-3 pb-4">
<button className="w-full bg-primary hover:bg-primary/90 text-primary-foreground font-bold rounded-lg py-2.5 px-4 flex items-center justify-center gap-2 transition-colors">
<Edit3 className="w-4 h-4" />
메일 작성
</button>
</div>
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

<nav aria-label="Mail sections" className="space-y-0.5">
{mailNavItems.map((item) => (
<NavLink key={item.label} {...item} />
))}
</nav>

<nav aria-label="AI Hub sections" className="mt-6 space-y-0.5">
<div className="flex items-center justify-between px-3 mb-1">
<p className="text-[11px] font-bold text-muted-foreground">AI 허브</p>
<span className="text-[9px] font-bold bg-primary/10 text-primary px-1.5 py-0.5 rounded">BETA</span>
</div>
{aiHubItems.map((item) => (
<NavLink key={item.label} {...item} />
))}
</nav>

<nav aria-label="Projects sections" className="mt-6 space-y-0.5">
<div className="flex items-center justify-between px-3 mb-1 cursor-pointer hover:bg-secondary/50 rounded-md py-1">
<p className="text-[11px] font-bold text-muted-foreground">프로젝트</p>
<svg width="10" height="10" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" className="text-muted-foreground"><path d="M4 6H11L7.5 10.5L4 6Z" fill="currentColor"></path></svg>
</div>
{projectItems.map((item) => (
<NavLink key={item.label} {...item} />
))}
</nav>

<nav aria-label="Labels sections" className="mt-6 space-y-0.5">
<div className="flex items-center justify-between px-3 mb-1 cursor-pointer hover:bg-secondary/50 rounded-md py-1">
<p className="text-[11px] font-bold text-muted-foreground">라벨</p>
<svg width="10" height="10" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" className="text-muted-foreground"><path d="M7 7V2H8V7H13V8H8V13H7V8H2V7H7Z" fill="currentColor"></path></svg>
</div>
{labelItems.map((item) => {
const active = pathname === item.href;
return (
<Link
key={item.label}
href={item.href}
className={`group flex min-h-8 items-center gap-3 rounded-lg px-3 py-1 text-sm transition-all focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/40 ${
active
? 'bg-primary/10 font-bold text-primary'
: 'text-sidebar-foreground hover:bg-sidebar-accent hover:text-primary'
}`}
>
<div className={`w-2 h-2 rounded-full ${item.color}`} />
{item.label}
</Link>
)
})}
</nav>

<div className="pt-6 px-3 pb-4">
<div className="bg-secondary/30 rounded-xl p-3 border border-border">
<div className="flex items-center justify-between mb-2">
<p className="text-[11px] font-bold text-foreground">오늘의 인사이트</p>
<TrendingUp className="w-3 h-3 text-muted-foreground" />
</div>
<p className="text-xs text-muted-foreground mb-1">업무 집중 시간</p>
<p className="text-xs font-bold">오전 10:00 - 12:00</p>
<div className="mt-3 h-12 flex items-end gap-1 opacity-60">
<div className="bg-primary/40 w-full rounded-t-sm h-[20%]"></div>
<div className="bg-primary/40 w-full rounded-t-sm h-[40%]"></div>
<div className="bg-primary/80 w-full rounded-t-sm h-[80%]"></div>
<div className="bg-primary w-full rounded-t-sm h-[100%]"></div>
<div className="bg-primary/60 w-full rounded-t-sm h-[60%]"></div>
</div>
</div>
</div>

<nav aria-label="AI workspace sections" className="sr-only">
{aiNavItems.map(({ label }) => (
<a key={label} href="#main-content">{label}</a>
Expand Down
Loading