Capture ThinkStorm project: codebase state, workflows, and access control policies
This commit is contained in:
@@ -0,0 +1,652 @@
|
||||
/* ==========================================================================
|
||||
ThinkStorm - Design System & Modern UI Stylesheet
|
||||
Dark Glassmorphism, Vibrant Accents, Modern Typography & Micro-Animations
|
||||
========================================================================== */
|
||||
|
||||
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');
|
||||
|
||||
:root {
|
||||
--bg-main: #090a10;
|
||||
--bg-card: rgba(18, 20, 32, 0.75);
|
||||
--bg-card-hover: rgba(26, 29, 46, 0.85);
|
||||
--bg-glass: rgba(255, 255, 255, 0.03);
|
||||
--border-glass: rgba(255, 255, 255, 0.08);
|
||||
--border-focus: rgba(99, 102, 241, 0.5);
|
||||
|
||||
--text-primary: #f8fafc;
|
||||
--text-secondary: #94a3b8;
|
||||
--text-muted: #64748b;
|
||||
|
||||
--accent-primary: #6366f1;
|
||||
--accent-primary-hover: #4f46e5;
|
||||
--accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
|
||||
--accent-glow: 0 0 25px rgba(99, 102, 241, 0.35);
|
||||
|
||||
--color-success: #10b981;
|
||||
--color-success-bg: rgba(16, 185, 129, 0.12);
|
||||
--color-warning: #f59e0b;
|
||||
--color-warning-bg: rgba(245, 158, 11, 0.12);
|
||||
--color-danger: #ef4444;
|
||||
--color-danger-bg: rgba(239, 68, 68, 0.12);
|
||||
--color-info: #06b6d4;
|
||||
--color-info-bg: rgba(6, 182, 212, 0.12);
|
||||
|
||||
--font-sans: 'Inter', system-ui, -apple-system, sans-serif;
|
||||
--font-heading: 'Outfit', system-ui, -apple-system, sans-serif;
|
||||
--font-mono: 'Fira Code', monospace;
|
||||
|
||||
--radius-sm: 6px;
|
||||
--radius-md: 10px;
|
||||
--radius-lg: 16px;
|
||||
--radius-xl: 24px;
|
||||
|
||||
--shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
|
||||
--shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
|
||||
--shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
|
||||
|
||||
--transition-fast: 0.15s ease;
|
||||
--transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
|
||||
}
|
||||
|
||||
*, *::before, *::after {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--bg-main);
|
||||
background-image:
|
||||
radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
|
||||
radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.06) 0px, transparent 50%);
|
||||
background-attachment: fixed;
|
||||
color: var(--text-primary);
|
||||
font-family: var(--font-sans);
|
||||
line-height: 1.6;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
/* Typography */
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
font-family: var(--font-heading);
|
||||
color: var(--text-primary);
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--accent-primary);
|
||||
text-decoration: none;
|
||||
transition: color var(--transition-fast);
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #a5b4fc;
|
||||
}
|
||||
|
||||
/* Glassmorphism Card */
|
||||
.glass-card {
|
||||
background: var(--bg-card);
|
||||
backdrop-filter: blur(16px);
|
||||
-webkit-backdrop-filter: blur(16px);
|
||||
border: 1px solid var(--border-glass);
|
||||
border-radius: var(--radius-lg);
|
||||
box-shadow: var(--shadow-md);
|
||||
transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
|
||||
}
|
||||
|
||||
.glass-card:hover {
|
||||
border-color: rgba(255, 255, 255, 0.15);
|
||||
}
|
||||
|
||||
.glass-card.interactive:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: var(--shadow-lg);
|
||||
}
|
||||
|
||||
/* Layout */
|
||||
.container {
|
||||
width: 100%;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0 1.5rem;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
flex: 1;
|
||||
padding: 2.5rem 0 4rem;
|
||||
}
|
||||
|
||||
/* Navigation Bar */
|
||||
.navbar {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
background: rgba(9, 10, 16, 0.85);
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
border-bottom: 1px solid var(--border-glass);
|
||||
padding: 0.85rem 0;
|
||||
}
|
||||
|
||||
.nav-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.brand-logo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
font-family: var(--font-heading);
|
||||
font-size: 1.35rem;
|
||||
font-weight: 800;
|
||||
color: var(--text-primary);
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
|
||||
.brand-logo .brand-icon {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
background: var(--accent-gradient);
|
||||
border-radius: var(--radius-sm);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: var(--accent-glow);
|
||||
}
|
||||
|
||||
.nav-links {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1.5rem;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.nav-link {
|
||||
color: var(--text-secondary);
|
||||
font-weight: 500;
|
||||
font-size: 0.95rem;
|
||||
padding: 0.4rem 0.8rem;
|
||||
border-radius: var(--radius-sm);
|
||||
transition: all var(--transition-fast);
|
||||
}
|
||||
|
||||
.nav-link:hover, .nav-link.active {
|
||||
color: var(--text-primary);
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
|
||||
.nav-auth-pill {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.6rem;
|
||||
padding: 0.35rem 0.85rem;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
border: 1px solid var(--border-glass);
|
||||
border-radius: 999px;
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.nav-auth-pill .user-role {
|
||||
font-size: 0.7rem;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
padding: 0.15rem 0.45rem;
|
||||
border-radius: 999px;
|
||||
background: var(--accent-primary);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.5rem;
|
||||
font-family: var(--font-sans);
|
||||
font-size: 0.95rem;
|
||||
font-weight: 600;
|
||||
padding: 0.65rem 1.4rem;
|
||||
border-radius: var(--radius-md);
|
||||
border: 1px solid transparent;
|
||||
cursor: pointer;
|
||||
transition: all var(--transition-fast);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: var(--accent-gradient);
|
||||
color: #fff;
|
||||
box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #c026d3 100%);
|
||||
box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
|
||||
transform: translateY(-1px);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
border-color: var(--border-glass);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.btn-secondary:hover {
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
border-color: rgba(255, 255, 255, 0.2);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn-sm {
|
||||
padding: 0.4rem 0.85rem;
|
||||
font-size: 0.82rem;
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
background: var(--color-danger);
|
||||
color: #fff;
|
||||
}
|
||||
.btn-danger:hover {
|
||||
background: #dc2626;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn-success {
|
||||
background: var(--color-success);
|
||||
color: #fff;
|
||||
}
|
||||
.btn-success:hover {
|
||||
background: #059669;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* Badges & Pills */
|
||||
.badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
padding: 0.2rem 0.6rem;
|
||||
border-radius: 999px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
font-family: var(--font-mono);
|
||||
}
|
||||
|
||||
.badge-available { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
|
||||
.badge-claimed { background: rgba(99, 102, 241, 0.15); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, 0.3); }
|
||||
.badge-active { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
|
||||
.badge-completed { background: rgba(59, 130, 246, 0.15); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.3); }
|
||||
.badge-quarantined { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
|
||||
.badge-trashed { background: rgba(239, 68, 68, 0.18); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.35); }
|
||||
.badge-duplicate { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }
|
||||
.badge-safe { background: rgba(16, 185, 129, 0.15); color: #34d399; }
|
||||
.badge-malicious { background: rgba(239, 68, 68, 0.2); color: #f87171; }
|
||||
.badge-suspicious { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
|
||||
|
||||
.btn-outline-danger {
|
||||
background: transparent;
|
||||
border: 1px solid rgba(239, 68, 68, 0.4);
|
||||
color: #f87171;
|
||||
}
|
||||
.btn-outline-danger:hover {
|
||||
background: rgba(239, 68, 68, 0.15);
|
||||
border-color: #ef4444;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* Maturity Level Meter */
|
||||
.maturity-meter {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
padding: 0.25rem 0.55rem;
|
||||
border-radius: var(--radius-sm);
|
||||
border: 1px solid var(--border-glass);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.78rem;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.maturity-meter .dots {
|
||||
display: flex;
|
||||
gap: 3px;
|
||||
}
|
||||
|
||||
.maturity-meter .dot {
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
border-radius: 50%;
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
}
|
||||
|
||||
.maturity-meter .dot.active {
|
||||
background: var(--accent-primary);
|
||||
box-shadow: 0 0 8px var(--accent-primary);
|
||||
}
|
||||
|
||||
/* Forms & Inputs */
|
||||
.form-group {
|
||||
margin-bottom: 1.25rem;
|
||||
}
|
||||
|
||||
.form-label {
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
font-size: 0.9rem;
|
||||
color: var(--text-secondary);
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.form-input, .form-textarea, .form-select {
|
||||
width: 100%;
|
||||
padding: 0.75rem 1rem;
|
||||
background: rgba(12, 14, 24, 0.8);
|
||||
border: 1px solid var(--border-glass);
|
||||
border-radius: var(--radius-md);
|
||||
color: var(--text-primary);
|
||||
font-family: var(--font-sans);
|
||||
font-size: 0.95rem;
|
||||
transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
|
||||
}
|
||||
|
||||
.form-input:focus, .form-textarea:focus, .form-select:focus {
|
||||
outline: none;
|
||||
border-color: var(--accent-primary);
|
||||
box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
|
||||
}
|
||||
|
||||
.form-textarea {
|
||||
min-height: 180px;
|
||||
resize: vertical;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* Public Submission Box */
|
||||
.hero-intake {
|
||||
text-align: center;
|
||||
max-width: 800px;
|
||||
margin: 2rem auto 3.5rem;
|
||||
}
|
||||
|
||||
.hero-title {
|
||||
font-size: 3.25rem;
|
||||
line-height: 1.1;
|
||||
margin-bottom: 1rem;
|
||||
background: linear-gradient(180deg, #ffffff 0%, #94a3b8 100%);
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
}
|
||||
|
||||
.hero-subtitle {
|
||||
font-size: 1.2rem;
|
||||
color: var(--text-secondary);
|
||||
margin-bottom: 2.2rem;
|
||||
}
|
||||
|
||||
.intake-box {
|
||||
background: var(--bg-card);
|
||||
backdrop-filter: blur(20px);
|
||||
border: 1px solid var(--border-glass);
|
||||
border-radius: var(--radius-xl);
|
||||
padding: 2rem;
|
||||
box-shadow: var(--shadow-lg);
|
||||
position: relative;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.intake-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-top: 1.25rem;
|
||||
flex-wrap: wrap;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.intake-hints {
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
/* Ideas Grid & Filters */
|
||||
.ideas-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 1rem;
|
||||
margin-bottom: 2rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.filter-pills {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.filter-pill {
|
||||
padding: 0.4rem 0.9rem;
|
||||
border-radius: 999px;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 600;
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
border: 1px solid var(--border-glass);
|
||||
color: var(--text-secondary);
|
||||
cursor: pointer;
|
||||
transition: all var(--transition-fast);
|
||||
}
|
||||
|
||||
.filter-pill:hover, .filter-pill.active {
|
||||
background: var(--accent-primary);
|
||||
border-color: var(--accent-primary);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.filter-pill-trash:hover, .filter-pill-trash.active {
|
||||
background: #dc2626 !important;
|
||||
border-color: #ef4444 !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.card-trashed {
|
||||
border-color: rgba(239, 68, 68, 0.3) !important;
|
||||
background: rgba(239, 68, 68, 0.04) !important;
|
||||
}
|
||||
|
||||
.ideas-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
.idea-card {
|
||||
padding: 1.5rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.idea-card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 0.85rem;
|
||||
}
|
||||
|
||||
.idea-id-link {
|
||||
font-family: var(--font-mono);
|
||||
font-weight: 700;
|
||||
font-size: 0.9rem;
|
||||
color: var(--accent-primary);
|
||||
}
|
||||
|
||||
.idea-card-title {
|
||||
font-size: 1.25rem;
|
||||
margin-bottom: 0.6rem;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.idea-card-summary {
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.92rem;
|
||||
flex: 1;
|
||||
margin-bottom: 1.2rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.idea-card-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border-top: 1px solid var(--border-glass);
|
||||
padding-top: 1rem;
|
||||
font-size: 0.82rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.tag-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.4rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.tag-item {
|
||||
font-size: 0.75rem;
|
||||
font-family: var(--font-mono);
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
padding: 0.15rem 0.5rem;
|
||||
border-radius: var(--radius-sm);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
/* Tabbed Interface */
|
||||
.tab-container {
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
|
||||
.tab-nav {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
border-bottom: 1px solid var(--border-glass);
|
||||
margin-bottom: 1.5rem;
|
||||
overflow-x: auto;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.tab-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-secondary);
|
||||
font-family: var(--font-heading);
|
||||
font-weight: 600;
|
||||
font-size: 1rem;
|
||||
padding: 0.6rem 1.1rem;
|
||||
cursor: pointer;
|
||||
border-radius: var(--radius-md);
|
||||
transition: all var(--transition-fast);
|
||||
}
|
||||
|
||||
.tab-btn:hover {
|
||||
color: var(--text-primary);
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
}
|
||||
|
||||
.tab-btn.active {
|
||||
color: var(--accent-primary);
|
||||
background: rgba(99, 102, 241, 0.1);
|
||||
border-bottom: 2px solid var(--accent-primary);
|
||||
}
|
||||
|
||||
.tab-panel {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tab-panel.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Code & Markdown View */
|
||||
.markdown-body {
|
||||
color: #e2e8f0;
|
||||
font-size: 0.95rem;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
|
||||
margin-top: 1.5rem;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
|
||||
.markdown-body ul, .markdown-body ol {
|
||||
padding-left: 1.5rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.markdown-body blockquote {
|
||||
border-left: 3px solid var(--accent-primary);
|
||||
padding-left: 1rem;
|
||||
color: var(--text-secondary);
|
||||
margin: 1rem 0;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.markdown-body pre {
|
||||
background: #0d0f18;
|
||||
border: 1px solid var(--border-glass);
|
||||
border-radius: var(--radius-md);
|
||||
padding: 1rem;
|
||||
overflow-x: auto;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.88rem;
|
||||
margin: 1rem 0;
|
||||
}
|
||||
|
||||
/* Toast Notifications */
|
||||
#toast-container {
|
||||
position: fixed;
|
||||
bottom: 2rem;
|
||||
right: 2rem;
|
||||
z-index: 1000;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.toast {
|
||||
background: var(--bg-card);
|
||||
backdrop-filter: blur(20px);
|
||||
border: 1px solid var(--border-glass);
|
||||
border-radius: var(--radius-md);
|
||||
padding: 0.85rem 1.25rem;
|
||||
color: var(--text-primary);
|
||||
font-size: 0.9rem;
|
||||
box-shadow: var(--shadow-lg);
|
||||
animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
||||
}
|
||||
|
||||
@keyframes slideIn {
|
||||
from { transform: translateX(100%); opacity: 0; }
|
||||
to { transform: translateX(0); opacity: 1; }
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 768px) {
|
||||
.hero-title { font-size: 2.25rem; }
|
||||
.ideas-grid { grid-template-columns: 1fr; }
|
||||
.nav-links { display: none; }
|
||||
.intake-box { padding: 1.25rem; }
|
||||
}
|
||||
@@ -0,0 +1,425 @@
|
||||
/**
|
||||
* ThinkStorm Modern Frontend Client
|
||||
* Interactive UI, AJAX workflows, tabs, modals, and notifications.
|
||||
*/
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
initTabs();
|
||||
initIntakeBox();
|
||||
});
|
||||
|
||||
// ----------------- Toast Notifications -----------------
|
||||
function showToast(message, type = 'info') {
|
||||
let container = document.getElementById('toast-container');
|
||||
if (!container) {
|
||||
container = document.createElement('div');
|
||||
container.id = 'toast-container';
|
||||
document.body.appendChild(container);
|
||||
}
|
||||
const toast = document.createElement('div');
|
||||
toast.className = `toast toast-${type}`;
|
||||
toast.innerText = message;
|
||||
container.appendChild(toast);
|
||||
setTimeout(() => {
|
||||
toast.style.opacity = '0';
|
||||
toast.style.transform = 'translateY(10px)';
|
||||
setTimeout(() => toast.remove(), 300);
|
||||
}, 3500);
|
||||
}
|
||||
|
||||
// ----------------- Tab Navigation -----------------
|
||||
function initTabs() {
|
||||
const tabContainers = document.querySelectorAll('.tab-container');
|
||||
tabContainers.forEach(container => {
|
||||
const btns = container.querySelectorAll('.tab-btn');
|
||||
const panels = container.querySelectorAll('.tab-panel');
|
||||
|
||||
function activateTab(rawKey) {
|
||||
if (!rawKey) return;
|
||||
const cleanKey = String(rawKey).replace(/^#+/, '').replace(/^tab-/, '').trim();
|
||||
if (!cleanKey) return;
|
||||
|
||||
const targetBtn = container.querySelector(`.tab-btn[data-tab="tab-${cleanKey}"]`) ||
|
||||
container.querySelector(`.tab-btn[data-tab="${cleanKey}"]`);
|
||||
const targetPanel = container.querySelector(`#tab-${cleanKey}`) ||
|
||||
container.querySelector(`#${cleanKey}`);
|
||||
|
||||
if (targetBtn && targetPanel) {
|
||||
btns.forEach(b => b.classList.remove('active'));
|
||||
panels.forEach(p => p.classList.remove('active'));
|
||||
targetBtn.classList.add('active');
|
||||
targetPanel.classList.add('active');
|
||||
|
||||
try {
|
||||
history.replaceState(null, null, `#${cleanKey}`);
|
||||
sessionStorage.setItem(`thinkstorm_active_tab_${window.location.pathname}`, `tab-${cleanKey}`);
|
||||
localStorage.setItem(`thinkstorm_active_tab_${window.location.pathname}`, `tab-${cleanKey}`);
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
|
||||
btns.forEach(btn => {
|
||||
btn.addEventListener('click', () => {
|
||||
const target = btn.getAttribute('data-tab');
|
||||
activateTab(target);
|
||||
});
|
||||
});
|
||||
|
||||
// Check URL hash, sessionStorage, or localStorage on load
|
||||
const hash = window.location.hash;
|
||||
const sessionSaved = sessionStorage.getItem(`thinkstorm_active_tab_${window.location.pathname}`);
|
||||
const localSaved = localStorage.getItem(`thinkstorm_active_tab_${window.location.pathname}`);
|
||||
|
||||
if (hash && hash.length > 1) {
|
||||
activateTab(hash);
|
||||
} else if (sessionSaved) {
|
||||
activateTab(sessionSaved);
|
||||
} else if (localSaved) {
|
||||
activateTab(localSaved);
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener('hashchange', () => {
|
||||
const hash = window.location.hash;
|
||||
if (hash && hash.length > 1) {
|
||||
const cleanKey = hash.replace(/^#+/, '').replace(/^tab-/, '').trim();
|
||||
const tabContainers = document.querySelectorAll('.tab-container');
|
||||
tabContainers.forEach(c => {
|
||||
const targetBtn = c.querySelector(`.tab-btn[data-tab="tab-${cleanKey}"]`) || c.querySelector(`.tab-btn[data-tab="${cleanKey}"]`);
|
||||
const targetPanel = c.querySelector(`#tab-${cleanKey}`) || c.querySelector(`#${cleanKey}`);
|
||||
if (targetBtn && targetPanel) {
|
||||
c.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
|
||||
c.querySelectorAll('.tab-panel').forEach(p => p.classList.remove('active'));
|
||||
targetBtn.classList.add('active');
|
||||
targetPanel.classList.add('active');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ----------------- Public Intake Box -----------------
|
||||
function initIntakeBox() {
|
||||
const textarea = document.getElementById('submission-text');
|
||||
const counter = document.getElementById('char-count');
|
||||
const urlCount = document.getElementById('detected-urls');
|
||||
const form = document.getElementById('intake-form');
|
||||
|
||||
if (textarea) {
|
||||
textarea.addEventListener('input', () => {
|
||||
const len = textarea.value.length;
|
||||
if (counter) counter.innerText = `${len} / 10,000`;
|
||||
|
||||
// Live URL detection
|
||||
const urls = textarea.value.match(/https?:\/\/[^\s<>"]+/gi) || [];
|
||||
if (urlCount) {
|
||||
urlCount.innerText = urls.length > 0 ? `${urls.length} URL(s) detected` : 'No URLs detected';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (form) {
|
||||
form.addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
const text = textarea.value.trim();
|
||||
if (!text) {
|
||||
showToast('Please enter an idea description.', 'warning');
|
||||
return;
|
||||
}
|
||||
|
||||
const submitBtn = form.querySelector('button[type="submit"]');
|
||||
submitBtn.disabled = true;
|
||||
submitBtn.innerText = 'Preserving & Ingesting...';
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/ideas', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ text })
|
||||
});
|
||||
const data = await res.json();
|
||||
if (!res.ok) throw new Error(data.detail || 'Submission failed');
|
||||
|
||||
showToast(`Idea preserved as ${data.id}! Ingestion started.`, 'success');
|
||||
textarea.value = '';
|
||||
const isAuthenticated = Boolean(document.querySelector('.nav-auth-pill'));
|
||||
setTimeout(() => {
|
||||
if (isAuthenticated) {
|
||||
window.location.href = `/ideas/${data.id}`;
|
||||
} else {
|
||||
submitBtn.disabled = false;
|
||||
submitBtn.innerText = 'Submit Idea';
|
||||
showToast(`Idea ${data.id} submitted! It will appear in the catalog once available.`, 'info');
|
||||
}
|
||||
}, 1000);
|
||||
} catch (err) {
|
||||
showToast(err.message, 'danger');
|
||||
submitBtn.disabled = false;
|
||||
submitBtn.innerText = 'Submit Idea';
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------- Idea Actions (Claim, Release, Activate) -----------------
|
||||
async function claimIdea(ideaId) {
|
||||
try {
|
||||
const res = await fetch(`/api/ideas/${ideaId}/claim`, { method: 'POST' });
|
||||
const data = await res.json();
|
||||
if (!res.ok) throw new Error(data.detail || 'Claim failed');
|
||||
showToast(data.message, 'success');
|
||||
setTimeout(() => window.location.reload(), 800);
|
||||
} catch (err) {
|
||||
showToast(err.message, 'danger');
|
||||
}
|
||||
}
|
||||
|
||||
async function releaseIdea(ideaId) {
|
||||
if (!confirm('Are you sure you want to release your claim on this idea?')) return;
|
||||
try {
|
||||
const res = await fetch(`/api/ideas/${ideaId}/release`, { method: 'POST' });
|
||||
const data = await res.json();
|
||||
if (!res.ok) throw new Error(data.detail || 'Release failed');
|
||||
showToast(data.message, 'info');
|
||||
setTimeout(() => window.location.reload(), 800);
|
||||
} catch (err) {
|
||||
showToast(err.message, 'danger');
|
||||
}
|
||||
}
|
||||
|
||||
async function activateIdea(ideaId) {
|
||||
try {
|
||||
const res = await fetch(`/api/ideas/${ideaId}/activate`, { method: 'POST' });
|
||||
const data = await res.json();
|
||||
if (!res.ok) throw new Error(data.detail || 'Activation failed');
|
||||
showToast(data.message, 'success');
|
||||
setTimeout(() => window.location.reload(), 800);
|
||||
} catch (err) {
|
||||
showToast(err.message, 'danger');
|
||||
}
|
||||
}
|
||||
|
||||
async function trashIdea(ideaId) {
|
||||
console.log('[ThinkStorm] Trashing idea:', ideaId);
|
||||
try {
|
||||
const res = await fetch(`/api/ideas/${ideaId}/trash`, { method: 'POST' });
|
||||
const data = await res.json();
|
||||
if (!res.ok) throw new Error(data.detail || 'Failed to move idea to trash');
|
||||
showToast(data.message || `Idea ${ideaId} moved to trash`, 'info');
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 400);
|
||||
} catch (err) {
|
||||
console.error('[ThinkStorm] Trash error:', err);
|
||||
showToast(err.message || 'Trash operation failed', 'danger');
|
||||
}
|
||||
}
|
||||
|
||||
async function restoreIdea(ideaId) {
|
||||
console.log('[ThinkStorm] Restoring idea:', ideaId);
|
||||
try {
|
||||
const res = await fetch(`/api/ideas/${ideaId}/restore`, { method: 'POST' });
|
||||
const data = await res.json();
|
||||
if (!res.ok) throw new Error(data.detail || 'Failed to restore idea');
|
||||
showToast(data.message || `Idea ${ideaId} restored!`, 'success');
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 400);
|
||||
} catch (err) {
|
||||
console.error('[ThinkStorm] Restore error:', err);
|
||||
showToast(err.message || 'Restore operation failed', 'danger');
|
||||
}
|
||||
}
|
||||
|
||||
async function deleteIdeaPermanently(ideaId) {
|
||||
console.log('[ThinkStorm] Permanently deleting idea:', ideaId);
|
||||
try {
|
||||
const res = await fetch(`/api/ideas/${ideaId}/permanent`, { method: 'DELETE' });
|
||||
const data = await res.json();
|
||||
if (!res.ok) throw new Error(data.detail || 'Permanent deletion failed');
|
||||
showToast(data.message || `Idea ${ideaId} deleted permanently`, 'info');
|
||||
setTimeout(() => {
|
||||
if (window.location.pathname.includes(`/ideas/${ideaId}`)) {
|
||||
window.location.href = '/ideas?state=TRASHED';
|
||||
} else {
|
||||
window.location.reload();
|
||||
}
|
||||
}, 400);
|
||||
} catch (err) {
|
||||
console.error('[ThinkStorm] Delete error:', err);
|
||||
showToast(err.message || 'Permanent deletion failed', 'danger');
|
||||
}
|
||||
}
|
||||
|
||||
async function emptyTrash() {
|
||||
console.log('[ThinkStorm] Emptying entire trash bin');
|
||||
try {
|
||||
const res = await fetch('/api/trash/empty', { method: 'POST' });
|
||||
const data = await res.json();
|
||||
if (!res.ok) throw new Error(data.detail || 'Failed to empty trash');
|
||||
showToast(data.message || 'Trash bin emptied!', 'success');
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 400);
|
||||
} catch (err) {
|
||||
console.error('[ThinkStorm] Empty trash error:', err);
|
||||
showToast(err.message || 'Empty trash failed', 'danger');
|
||||
}
|
||||
}
|
||||
|
||||
async function createWorkTrack(ideaId) {
|
||||
const workType = document.getElementById('work-type-select').value;
|
||||
const name = document.getElementById('work-track-name').value.trim();
|
||||
const modelOverride = document.getElementById('work-model-select')?.value || null;
|
||||
if (!name) {
|
||||
showToast('Please provide a track title.', 'warning');
|
||||
return;
|
||||
}
|
||||
sessionStorage.setItem(`thinkstorm_active_tab_${window.location.pathname}`, 'tab-worktracks');
|
||||
history.replaceState(null, null, '#worktracks');
|
||||
try {
|
||||
const res = await fetch(`/api/ideas/${ideaId}/work-tracks`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ work_type_id: workType, name, model_override: modelOverride })
|
||||
});
|
||||
const data = await res.json();
|
||||
if (!res.ok) throw new Error(data.detail || 'Track creation failed');
|
||||
showToast(`Work Track '${data.name}' created!`, 'success');
|
||||
setTimeout(() => window.location.reload(), 600);
|
||||
} catch (err) {
|
||||
showToast(err.message, 'danger');
|
||||
}
|
||||
}
|
||||
|
||||
async function activateWorkTrack(trackId) {
|
||||
const modelSelect = document.getElementById(`model-select-${trackId}`);
|
||||
const modelOverride = modelSelect ? modelSelect.value : null;
|
||||
console.log(`[ThinkStorm] Activating work track ${trackId} with model:`, modelOverride || 'default');
|
||||
sessionStorage.setItem(`thinkstorm_active_tab_${window.location.pathname}`, 'tab-worktracks');
|
||||
history.replaceState(null, null, '#worktracks');
|
||||
try {
|
||||
const res = await fetch(`/api/ideas/work-tracks/${trackId}/activate`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ model_override: modelOverride })
|
||||
});
|
||||
const data = await res.json();
|
||||
if (!res.ok) throw new Error(data.detail || 'Track activation failed');
|
||||
showToast(data.message || `Work track ${trackId} queued for generation!`, 'info');
|
||||
setTimeout(() => window.location.reload(), 800);
|
||||
} catch (err) {
|
||||
showToast(err.message, 'danger');
|
||||
}
|
||||
}
|
||||
|
||||
async function deleteWorkTrackOutput(outputId, docName, version) {
|
||||
console.log(`[ThinkStorm] Deleting artifact output ID ${outputId} (${docName} v${version})`);
|
||||
sessionStorage.setItem(`thinkstorm_active_tab_${window.location.pathname}`, 'tab-worktracks');
|
||||
history.replaceState(null, null, '#worktracks');
|
||||
try {
|
||||
const res = await fetch(`/api/ideas/work-tracks/outputs/${outputId}`, {
|
||||
method: 'DELETE'
|
||||
});
|
||||
const data = await res.json();
|
||||
if (!res.ok) throw new Error(data.detail || 'Artifact deletion failed');
|
||||
showToast(data.message || `Artifact ${docName} (v${version}) deleted.`, 'info');
|
||||
setTimeout(() => window.location.reload(), 500);
|
||||
} catch (err) {
|
||||
console.error('[ThinkStorm] Delete artifact error:', err);
|
||||
showToast(err.message || 'Failed to delete artifact', 'danger');
|
||||
}
|
||||
}
|
||||
|
||||
async function graduateToGitea(trackId) {
|
||||
if (!confirm('Graduate this Coding Project to Gitea?')) return;
|
||||
sessionStorage.setItem(`thinkstorm_active_tab_${window.location.pathname}`, 'tab-worktracks');
|
||||
history.replaceState(null, null, '#worktracks');
|
||||
try {
|
||||
const res = await fetch(`/api/ideas/work-tracks/${trackId}/graduate`, { method: 'POST' });
|
||||
const data = await res.json();
|
||||
if (!res.ok) throw new Error(data.detail || 'Graduation failed');
|
||||
showToast('Graduated to Gitea successfully!', 'success');
|
||||
setTimeout(() => window.location.reload(), 1000);
|
||||
} catch (err) {
|
||||
showToast(err.message, 'danger');
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------- Admin Helpers -----------------
|
||||
async function testService(serviceId) {
|
||||
const btn = document.getElementById(`test-btn-${serviceId}`);
|
||||
if (btn) btn.innerText = 'Testing...';
|
||||
try {
|
||||
const res = await fetch(`/api/admin/services/${serviceId}/test`, { method: 'POST' });
|
||||
const data = await res.json();
|
||||
if (!res.ok) throw new Error(data.detail || 'Service test failed');
|
||||
showToast(`[${serviceId.toUpperCase()}] ${data.message}`, data.healthy ? 'success' : 'danger');
|
||||
setTimeout(() => window.location.reload(), 1000);
|
||||
} catch (err) {
|
||||
showToast(err.message, 'danger');
|
||||
if (btn) btn.innerText = 'Test';
|
||||
}
|
||||
}
|
||||
|
||||
async function retryJob(ideaId) {
|
||||
try {
|
||||
const res = await fetch(`/api/admin/jobs/retry/${ideaId}`, { method: 'POST' });
|
||||
const data = await res.json();
|
||||
if (!res.ok) throw new Error(data.detail || 'Retry failed');
|
||||
showToast(data.message, 'info');
|
||||
setTimeout(() => window.location.reload(), 800);
|
||||
} catch (err) {
|
||||
showToast(err.message, 'danger');
|
||||
}
|
||||
}
|
||||
|
||||
async function quarantineDecision(ideaId, decision) {
|
||||
try {
|
||||
const res = await fetch(`/api/admin/quarantine/${ideaId}/decision`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ decision })
|
||||
});
|
||||
const data = await res.json();
|
||||
if (!res.ok) throw new Error(data.detail || 'Decision failed');
|
||||
showToast(data.message, 'success');
|
||||
setTimeout(() => window.location.reload(), 800);
|
||||
} catch (err) {
|
||||
showToast(err.message, 'danger');
|
||||
}
|
||||
}
|
||||
|
||||
async function syncIdeaToOpenGist(ideaId) {
|
||||
const btn = document.getElementById('sync-opengist-btn');
|
||||
if (btn) btn.innerText = 'Publishing...';
|
||||
sessionStorage.setItem(`thinkstorm_active_tab_${window.location.pathname}`, 'tab-artifacts');
|
||||
history.replaceState(null, null, '#artifacts');
|
||||
try {
|
||||
const res = await fetch(`/api/ideas/${ideaId}/sync-opengist`, { method: 'POST' });
|
||||
const data = await res.json();
|
||||
if (!res.ok) throw new Error(data.detail || 'Sync to OpenGist failed');
|
||||
showToast(data.message, 'success');
|
||||
setTimeout(() => window.location.reload(), 800);
|
||||
} catch (err) {
|
||||
showToast(err.message, 'danger');
|
||||
if (btn) btn.innerText = '🔄 Publish / Re-sync to OpenGist';
|
||||
}
|
||||
}
|
||||
|
||||
async function syncIdeaToGitea(ideaId) {
|
||||
const btn = document.getElementById('sync-gitea-btn');
|
||||
if (btn) btn.innerText = 'Publishing to Gitea...';
|
||||
sessionStorage.setItem(`thinkstorm_active_tab_${window.location.pathname}`, 'tab-artifacts');
|
||||
history.replaceState(null, null, '#artifacts');
|
||||
try {
|
||||
const res = await fetch(`/api/ideas/${ideaId}/sync-gitea`, { method: 'POST' });
|
||||
const data = await res.json();
|
||||
if (!res.ok) throw new Error(data.detail || 'Sync to Gitea failed');
|
||||
showToast(data.message, 'success');
|
||||
setTimeout(() => window.location.reload(), 800);
|
||||
} catch (err) {
|
||||
showToast(err.message, 'danger');
|
||||
if (btn) btn.innerText = '🔄 Publish / Re-sync to Gitea';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user