c056c49194
- Add RESOURCES database mapping 6 dimensions to 30+ resource links - Results page now shows personalized resource recommendations matched to dimensions scoring below 60 - localStorage persistence: auto-saves progress mid-assessment (resumable within 24h), saves results history (last 10) - Print styles: clean print layout hiding nav/footer/buttons - Share button: Web Share API with clipboard fallback - Results page: color-coded dimension cards, SVG wheel chart, overall score, resource cards with dim labels and links - Past assessments history with clickable entries to revisit - All data remains client-side only (no server, no tracking)
959 lines
55 KiB
HTML
959 lines
55 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Wheel of Wellness Assessment</title>
|
|
<meta name="description" content="Find the resources your family needs in 5 minutes. A wellness assessment across six dimensions.">
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
|
|
<style>
|
|
:root{--primary:#2E7D6F;--primary-dark:#1F5C52;--primary-light:#3A9A88;--secondary:#E8835C;--cream:#FFF8F0;--charcoal:#2D3436;--gray-100:#F7F7F7;--gray-200:#E8E8E8;--gray-300:#D1D1D1;--gray-400:#9E9E9E;--gray-500:#6B6B6B;--green:#4CAF50;--green-light:#E8F5E9;--yellow:#FFC107;--yellow-light:#FFF8E1;--red:#E85C4A;--red-light:#FFEBEE;--blue:#1565C0;--blue-light:#E3F2FD;--shadow-sm:0 1px 3px rgba(0,0,0,.08);--shadow-md:0 4px 12px rgba(0,0,0,.1);--shadow-lg:0 8px 30px rgba(0,0,0,.12)}
|
|
*{margin:0;padding:0;box-sizing:border-box}
|
|
body{font-family:'Inter',-apple-system,BlinkMacSystemFont,sans-serif;background:var(--cream);color:var(--charcoal);-webkit-font-smoothing:antialiased;min-height:100vh;display:flex;flex-direction:column}
|
|
a{color:var(--primary);text-decoration:none}
|
|
|
|
/* Header */
|
|
.site-header{background:linear-gradient(135deg,var(--primary) 0%,var(--primary-dark) 100%);padding:12px 24px;display:flex;align-items:center;justify-content:space-between;color:white;position:sticky;top:0;z-index:50}
|
|
.site-header .brand{display:flex;align-items:center;gap:10px;font-size:15px;font-weight:700;letter-spacing:.3px}
|
|
.site-header .logo-icon{width:32px;height:32px;background:rgba(255,255,255,.2);border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:18px}
|
|
.site-header .nav-links{display:flex;gap:20px;font-size:13px;font-weight:500;opacity:.9}
|
|
.site-header .nav-links a{color:white;text-decoration:none;padding:4px 0}
|
|
.site-header .nav-links a:hover{opacity:1}
|
|
|
|
/* Footer */
|
|
.site-footer{background:var(--primary-dark);color:rgba(255,255,255,.7);text-align:center;padding:16px 20px;font-size:11px;letter-spacing:.3px;margin-top:auto}
|
|
.site-footer a{color:rgba(255,255,255,.9)}
|
|
|
|
/* Container */
|
|
.container{max-width:900px;margin:0 auto;padding:24px 20px}
|
|
|
|
/* Screens */
|
|
.screen{display:none}
|
|
.screen.active{display:block}
|
|
|
|
/* Landing */
|
|
.landing{text-align:center;padding:40px 20px 60px}
|
|
.landing .eyebrow{font-size:11px;font-weight:600;letter-spacing:2px;text-transform:uppercase;color:var(--secondary);margin-bottom:8px}
|
|
.landing h1{font-size:clamp(28px,5vw,42px);font-weight:800;color:var(--primary-dark);line-height:1.15;margin-bottom:12px}
|
|
.landing .subtitle{font-size:17px;color:var(--secondary);font-weight:600;margin-bottom:16px}
|
|
.landing .intro{font-size:14px;color:var(--gray-500);line-height:1.7;max-width:560px;margin:0 auto 32px}
|
|
.feature-pills{display:flex;gap:10px;justify-content:center;flex-wrap:wrap;margin-bottom:32px}
|
|
.feature-pill{display:flex;align-items:center;gap:6px;background:white;border:1px solid var(--gray-200);border-radius:20px;padding:6px 14px;font-size:12px;color:var(--gray-500);font-weight:500;box-shadow:var(--shadow-sm)}
|
|
|
|
/* Saved results banner */
|
|
.saved-banner{display:none;background:var(--blue-light);border:1px solid #90CAF9;border-radius:10px;padding:10px 16px;margin-bottom:20px;font-size:13px;color:var(--blue);font-weight:500;cursor:pointer}
|
|
.saved-banner.visible{display:block}
|
|
.saved-banner:hover{background:#BBDEFB}
|
|
|
|
.wheel-svg{width:240px;height:240px;margin:0 auto 28px}
|
|
|
|
/* Audience selector */
|
|
.audience-section{margin-bottom:32px}
|
|
.audience-section h2{font-size:16px;font-weight:700;color:var(--primary-dark);margin-bottom:12px}
|
|
.audience-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px;max-width:700px;margin:0 auto}
|
|
.audience-card{background:white;border:2px solid var(--gray-200);border-radius:12px;padding:16px 12px;cursor:pointer;transition:all .15s;text-align:center}
|
|
.audience-card:hover{border-color:var(--primary);box-shadow:var(--shadow-md)}
|
|
.audience-card.selected{border-color:var(--primary);background:rgba(46,125,111,.05)}
|
|
.audience-card .aud-icon{font-size:28px;margin-bottom:6px}
|
|
.audience-card .aud-title{font-size:13px;font-weight:700;color:var(--charcoal)}
|
|
.audience-card .aud-desc{font-size:11px;color:var(--gray-400);margin-top:4px;line-height:1.4}
|
|
|
|
/* CTA */
|
|
.cta-button{display:inline-flex;align-items:center;gap:10px;background:linear-gradient(135deg,var(--secondary) 0%,#D06A42 100%);color:white;font-size:16px;font-weight:700;padding:14px 36px;border-radius:50px;border:none;cursor:pointer;box-shadow:0 4px 16px rgba(232,131,92,.35);letter-spacing:.3px;transition:transform .15s}
|
|
.cta-button:hover{transform:translateY(-1px)}
|
|
.cta-button:disabled{opacity:.5;cursor:not-allowed;transform:none}
|
|
.cta-subtext{font-size:11px;color:var(--gray-400);margin-top:10px}
|
|
|
|
/* Questions */
|
|
.questions-screen{padding-bottom:40px}
|
|
.progress-section{margin-bottom:20px}
|
|
.progress-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
|
|
.progress-header .label{font-size:13px;font-weight:600;color:var(--primary)}
|
|
.progress-header .count{font-size:12px;color:var(--gray-400);font-weight:500}
|
|
.progress-bar-track{width:100%;height:8px;background:var(--gray-200);border-radius:4px;overflow:hidden}
|
|
.progress-bar-fill{height:100%;background:linear-gradient(90deg,var(--primary) 0%,var(--primary-light) 100%);border-radius:4px;transition:width .3s ease}
|
|
.dim-indicator{display:flex;gap:6px;margin-bottom:20px;flex-wrap:wrap}
|
|
.dim-dot{width:10px;height:10px;border-radius:50%;transition:all .2s}
|
|
.dim-dot.active{transform:scale(1.4)}
|
|
|
|
.question-card{background:white;border-radius:14px;padding:24px 28px;box-shadow:var(--shadow-md);border:1px solid var(--gray-200);position:relative;animation:fadeIn .3s ease}
|
|
@keyframes fadeIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
|
|
.question-card .q-dim-label{font-size:10px;font-weight:700;letter-spacing:1.5px;text-transform:uppercase;margin-bottom:8px}
|
|
.question-card .q-text{font-size:16px;font-weight:600;color:var(--charcoal);line-height:1.5;margin-bottom:20px}
|
|
.question-card .q-number{font-size:11px;color:var(--gray-300);font-weight:600;position:absolute;top:24px;right:28px}
|
|
|
|
.options-list{display:flex;flex-direction:column;gap:10px}
|
|
.option-item{display:flex;align-items:center;gap:14px;padding:14px 18px;background:var(--gray-100);border:2px solid var(--gray-200);border-radius:10px;font-size:14px;color:var(--gray-500);cursor:pointer;transition:all .15s;font-weight:500}
|
|
.option-item:hover{border-color:var(--gray-300);background:white}
|
|
.option-item.selected{background:var(--green-light);border-color:var(--primary);color:var(--primary-dark)}
|
|
.option-item .opt-emoji{font-size:20px;width:28px;text-align:center}
|
|
.radio-circle{width:20px;height:20px;border-radius:50%;border:2px solid var(--gray-300);flex-shrink:0;display:flex;align-items:center;justify-content:center;transition:all .15s}
|
|
.option-item.selected .radio-circle{border-color:var(--primary);background:var(--primary)}
|
|
.option-item.selected .radio-circle::after{content:'';width:8px;height:8px;background:white;border-radius:50%}
|
|
|
|
/* Nav buttons */
|
|
.q-nav{display:flex;justify-content:space-between;margin-top:24px}
|
|
.q-nav button{padding:10px 28px;border-radius:8px;font-size:14px;font-weight:600;cursor:pointer;border:none;transition:all .15s}
|
|
.btn-prev{background:var(--gray-100);color:var(--gray-500);border:1px solid var(--gray-200)}
|
|
.btn-prev:hover{background:var(--gray-200)}
|
|
.btn-next{background:var(--primary);color:white}
|
|
.btn-next:hover{background:var(--primary-dark)}
|
|
.btn-next:disabled{opacity:.4;cursor:not-allowed}
|
|
.btn-submit{background:var(--secondary);color:white;font-size:16px;padding:14px 36px;border-radius:50px}
|
|
.btn-submit:hover{background:#D06A42}
|
|
|
|
/* Results */
|
|
.results-screen{padding-bottom:40px}
|
|
.results-header{text-align:center;margin-bottom:28px}
|
|
.results-header .completion-badge{display:inline-flex;align-items:center;gap:6px;background:var(--green-light);color:var(--green);font-size:11px;font-weight:600;padding:4px 14px;border-radius:16px;margin-bottom:8px}
|
|
.results-header h2{font-size:28px;font-weight:800;color:var(--primary-dark);margin-bottom:6px}
|
|
.results-header .summary{font-size:14px;color:var(--gray-500);max-width:520px;margin:0 auto;line-height:1.6}
|
|
|
|
.results-body{display:flex;gap:32px;align-items:flex-start;flex-wrap:wrap}
|
|
.results-wheel-wrap{flex-shrink:0;width:280px;height:280px;margin:0 auto}
|
|
|
|
.dimensions-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;flex:1;min-width:280px}
|
|
.dim-card{background:white;border-radius:12px;padding:16px 18px;box-shadow:var(--shadow-sm);border:1px solid var(--gray-200)}
|
|
.dim-card-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}
|
|
.dim-card-name{font-size:13px;font-weight:700;color:var(--charcoal);display:flex;align-items:center;gap:6px}
|
|
.dim-card-name .dim-icon{font-size:16px}
|
|
.dim-card .dim-score-text{font-size:24px;font-weight:800;margin-bottom:4px}
|
|
.dim-card .dim-desc{font-size:11px;color:var(--gray-400);line-height:1.4}
|
|
|
|
.status-badge{font-size:10px;font-weight:700;padding:3px 10px;border-radius:10px;letter-spacing:.3px}
|
|
.status-badge.strong{background:var(--green-light);color:var(--green)}
|
|
.status-badge.moderate{background:var(--yellow-light);color:#F9A825}
|
|
.status-badge.needs-attention{background:var(--red-light);color:var(--red)}
|
|
|
|
.overall-card{background:white;border-radius:14px;padding:20px 24px;box-shadow:var(--shadow-md);border:1px solid var(--gray-200);text-align:center;margin-top:20px}
|
|
.overall-card .overall-score{font-size:48px;font-weight:800;color:var(--primary-dark)}
|
|
.overall-card .overall-label{font-size:13px;color:var(--gray-400);font-weight:600}
|
|
|
|
.disclaimer{margin-top:24px;padding:16px 20px;background:rgba(46,125,111,.06);border-radius:10px;font-size:12px;color:var(--gray-500);line-height:1.6;text-align:center}
|
|
|
|
/* Resource cards */
|
|
.resource-section{margin-top:28px}
|
|
.resource-section h3{font-size:18px;font-weight:700;color:var(--primary-dark);margin-bottom:6px}
|
|
.resource-section .resource-intro{font-size:13px;color:var(--gray-500);margin-bottom:16px;line-height:1.5}
|
|
.resource-list{display:grid;grid-template-columns:1fr 1fr;gap:12px}
|
|
.resource-card{background:white;border-radius:12px;padding:18px 20px;box-shadow:var(--shadow-sm);border:1px solid var(--gray-200);border-left:4px solid var(--primary);transition:all .15s}
|
|
.resource-card:hover{box-shadow:var(--shadow-md);transform:translateY(-1px)}
|
|
.resource-card .res-dim{font-size:10px;font-weight:700;letter-spacing:1px;text-transform:uppercase;margin-bottom:4px}
|
|
.resource-card .res-name{font-size:14px;font-weight:700;color:var(--charcoal);margin-bottom:4px}
|
|
.resource-card .res-desc{font-size:12px;color:var(--gray-500);line-height:1.5}
|
|
.resource-card .res-link{display:inline-flex;align-items:center;gap:4px;margin-top:8px;font-size:12px;font-weight:600;color:var(--primary)}
|
|
|
|
/* Actions bar */
|
|
.actions-bar{display:flex;gap:12px;justify-content:center;flex-wrap:wrap;margin-top:24px}
|
|
.actions-bar button{padding:12px 24px;border-radius:50px;font-size:14px;font-weight:600;cursor:pointer;border:2px solid var(--gray-200);background:white;color:var(--gray-500);transition:all .15s;display:inline-flex;align-items:center;gap:6px}
|
|
.actions-bar button:hover{border-color:var(--primary);color:var(--primary)}
|
|
.actions-bar .btn-print{background:var(--primary);color:white;border-color:var(--primary)}
|
|
.actions-bar .btn-print:hover{background:var(--primary-dark);color:white}
|
|
.actions-bar .btn-reset{background:var(--gray-100)}
|
|
|
|
/* History section */
|
|
.history-section{margin-top:24px;text-align:center}
|
|
.history-section h4{font-size:13px;font-weight:600;color:var(--gray-400);margin-bottom:10px}
|
|
.history-item{display:inline-flex;align-items:center;gap:8px;padding:8px 16px;margin:4px;background:white;border:1px solid var(--gray-200);border-radius:20px;font-size:12px;color:var(--gray-500);cursor:pointer;transition:all .15s}
|
|
.history-item:hover{border-color:var(--primary);color:var(--primary)}
|
|
.history-item .hist-date{color:var(--gray-400)}
|
|
.history-item .hist-score{font-weight:700;color:var(--primary)}
|
|
|
|
@media(max-width:640px){
|
|
.audience-grid{grid-template-columns:1fr 1fr}
|
|
.dimensions-grid{grid-template-columns:1fr}
|
|
.resource-list{grid-template-columns:1fr}
|
|
.results-body{flex-direction:column;align-items:center}
|
|
.q-nav{flex-direction:column;gap:10px}
|
|
.q-nav button{width:100%}
|
|
}
|
|
|
|
/* Print styles */
|
|
@media print{
|
|
.site-header,.site-footer,.actions-bar,.btn-reset,.history-section,.disclaimer{display:none!important}
|
|
body{background:white}
|
|
.screen{display:block!important}
|
|
.container{padding:0;max-width:100%}
|
|
.results-body{flex-direction:row;flex-wrap:nowrap}
|
|
.results-wheel-wrap{width:200px;height:200px}
|
|
.dim-card,.resource-card{break-inside:avoid;box-shadow:none;border:1px solid #ddd}
|
|
.overall-card{break-inside:avoid}
|
|
.resource-section{break-inside:avoid}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<header class="site-header">
|
|
<div class="brand">
|
|
<div class="logo-icon">♿</div>
|
|
<span>Wheel of Wellness</span>
|
|
</div>
|
|
<nav class="nav-links">
|
|
<a href="#" onclick="showScreen('landing');return false">Home</a>
|
|
<a href="https://helpipedia.org" target="_blank">HELPipedia</a>
|
|
<a href="https://specialneeds.help" target="_blank">SpecialNeeds.help</a>
|
|
</nav>
|
|
</header>
|
|
|
|
<!-- Landing -->
|
|
<div id="screen-landing" class="screen active">
|
|
<div class="container landing">
|
|
<div class="eyebrow">HELPipedia / SpecialNeeds.help</div>
|
|
<h1>Wheel of Wellness</h1>
|
|
<p class="subtitle">Find the resources your family needs — in 5 minutes</p>
|
|
<p class="intro">Whether you are a parent, caregiver, or individual navigating disability, this quick assessment identifies your needs across six wellness areas and connects you to resources.</p>
|
|
|
|
<svg class="wheel-svg" viewBox="0 0 240 240" id="landing-wheel"></svg>
|
|
|
|
<div class="saved-banner" id="saved-banner" onclick="resumeAssessment()">
|
|
📋 You have a saved assessment in progress. Click here to continue.
|
|
</div>
|
|
|
|
<div class="audience-section">
|
|
<h2>Who are you?</h2>
|
|
<div class="audience-grid" id="audience-grid"></div>
|
|
</div>
|
|
|
|
<button class="cta-button" id="btn-start" disabled onclick="startAssessment()">
|
|
Start Your Assessment <span style="font-size:20px">→</span>
|
|
</button>
|
|
<p class="cta-subtext">18 questions · About 5 minutes · Private & anonymous</p>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Questions -->
|
|
<div id="screen-questions" class="screen">
|
|
<div class="container questions-screen">
|
|
<div class="progress-section">
|
|
<div class="progress-header">
|
|
<span class="label" id="dim-label"></span>
|
|
<span class="count" id="q-count"></span>
|
|
</div>
|
|
<div class="progress-bar-track">
|
|
<div class="progress-bar-fill" id="progress-fill"></div>
|
|
</div>
|
|
</div>
|
|
<div class="dim-indicator" id="dim-indicator"></div>
|
|
<div id="question-area"></div>
|
|
<div class="q-nav">
|
|
<button class="btn-prev" id="btn-prev" onclick="prevQuestion()">← Back</button>
|
|
<button class="btn-next" id="btn-next" onclick="nextQuestion()" disabled>Next →</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Results -->
|
|
<div id="screen-results" class="screen">
|
|
<div class="container results-screen">
|
|
<div class="results-header">
|
|
<div class="completion-badge">✓ Assessment Complete</div>
|
|
<h2>Your Wellness Results</h2>
|
|
<p class="summary" id="results-summary"></p>
|
|
</div>
|
|
<div class="results-body">
|
|
<div class="results-wheel-wrap">
|
|
<svg viewBox="0 0 280 280" id="results-wheel"></svg>
|
|
</div>
|
|
<div class="dimensions-grid" id="results-grid"></div>
|
|
</div>
|
|
<div class="overall-card">
|
|
<div class="overall-score" id="overall-score">--</div>
|
|
<div class="overall-label">Overall Wellness Score</div>
|
|
</div>
|
|
|
|
<!-- Resource recommendations -->
|
|
<div class="resource-section" id="resource-section">
|
|
<h3>🧭 Resources for You</h3>
|
|
<p class="resource-intro">Based on your results, here are resources from HELPipedia and SpecialNeeds.help that may help in the areas where you scored lower.</p>
|
|
<div class="resource-list" id="resource-list"></div>
|
|
</div>
|
|
|
|
<div class="actions-bar">
|
|
<button class="btn-print" onclick="window.print()">🖨 Print Results</button>
|
|
<button onclick="shareResults()">📤 Share Results</button>
|
|
<button class="btn-reset" onclick="retake()">↺ Take Again</button>
|
|
</div>
|
|
|
|
<div class="history-section" id="history-section">
|
|
<h4>Your Past Assessments</h4>
|
|
<div id="history-list"></div>
|
|
</div>
|
|
|
|
<div class="disclaimer">
|
|
This is a screening tool for self-reflection, not a diagnosis. If you have concerns about your wellbeing, please talk to a qualified professional.
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<footer class="site-footer">
|
|
<div>Powered by <a href="https://helpipedia.org" target="_blank">HELPipedia</a> · <a href="https://specialneeds.help" target="_blank">SpecialNeeds.help</a></div>
|
|
</footer>
|
|
|
|
<script>
|
|
// ═══════════════════════════════════════════
|
|
// DATA LAYER
|
|
// ═══════════════════════════════════════════
|
|
|
|
const QUESTIONS = {
|
|
"generalized": {
|
|
"title": "General",
|
|
"subtitle": "For anyone who wants to check in on their wellness",
|
|
"scale": ["Almost all the time", "More than half the time", "Some of the time", "Once in a while"],
|
|
"emoji": null,
|
|
"items": [
|
|
{"id":"G1","dim":"physical","text":"In the past month, how often have you felt tired or worn out?","reverse":true},
|
|
{"id":"G2","dim":"physical","text":"How would you rate your overall physical health right now?","reverse":false},
|
|
{"id":"G3","dim":"physical","text":"In a typical week, how often do you move your body in a way that feels good (walking, stretching, playing)?","reverse":false},
|
|
{"id":"G4","dim":"emotional","text":"In the past two weeks, how often have you felt calm and at ease?","reverse":false},
|
|
{"id":"G5","dim":"emotional","text":"In the past two weeks, how often have you felt cheerful or in good spirits?","reverse":false},
|
|
{"id":"G6","dim":"emotional","text":"How often have you felt worried, sad, or upset in a way that was hard to shake?","reverse":true},
|
|
{"id":"G7","dim":"social","text":"Do you have people in your life you can count on when things get hard?","reverse":false},
|
|
{"id":"G8","dim":"social","text":"How satisfied are you with how you get along with the people closest to you?","reverse":false},
|
|
{"id":"G9","dim":"social","text":"In the past month, how often have you felt alone even when other people were around?","reverse":true},
|
|
{"id":"G10","dim":"daily-life","text":"How confident are you that you can handle everyday tasks like bills, forms, and schedules?","reverse":false},
|
|
{"id":"G11","dim":"daily-life","text":"In the past two weeks, how often has your sleep been restful?","reverse":false},
|
|
{"id":"G12","dim":"daily-life","text":"How safe do you feel in your home and neighborhood?","reverse":false},
|
|
{"id":"G13","dim":"purpose","text":"In the past two weeks, how often has your daily life been filled with things that interest you?","reverse":false},
|
|
{"id":"G14","dim":"purpose","text":"How would you rate your quality of life right now?","reverse":false},
|
|
{"id":"G15","dim":"purpose","text":"Do you feel like your life has meaning or direction?","reverse":false},
|
|
{"id":"G16","dim":"growth","text":"In the past two weeks, how often have you felt active and full of energy?","reverse":false},
|
|
{"id":"G17","dim":"growth","text":"Are you learning or trying anything new right now?","reverse":false},
|
|
{"id":"G18","dim":"growth","text":"How often do you make time for things that help you grow (reading, classes, hobbies)?","reverse":false}
|
|
]
|
|
},
|
|
"parent-caregiver": {
|
|
"title": "Parent / Caregiver",
|
|
"subtitle": "For parents and caregivers of people with disabilities",
|
|
"scale": ["Almost every day", "More days than not", "Once in a while", "Rarely"],
|
|
"emoji": null,
|
|
"items": [
|
|
{"id":"P1","dim":"physical","text":"When did you last see a doctor for YOUR own health check?","reverse":false},
|
|
{"id":"P2","dim":"physical","text":"In the past month, how often have you felt tired or worn out from caregiving?","reverse":true},
|
|
{"id":"P3","dim":"physical","text":"In a typical week, how often do you get enough sleep?","reverse":false},
|
|
{"id":"P4","dim":"emotional","text":"How often do you feel worn out or weighed down by all you have to do?","reverse":true},
|
|
{"id":"P5","dim":"emotional","text":"In the past two weeks, how often have you been bothered by not being able to stop or control worrying?","reverse":true},
|
|
{"id":"P6","dim":"emotional","text":"How often do you feel like you are doing a good job as a caregiver?","reverse":false},
|
|
{"id":"P7","dim":"social","text":"Do you have someone who can watch your kids so you can take a break?","reverse":false},
|
|
{"id":"P8","dim":"social","text":"Is there someone you can talk to honestly about how hard caregiving can be?","reverse":false},
|
|
{"id":"P9","dim":"social","text":"How often do you spend time with friends or do something fun for yourself?","reverse":false},
|
|
{"id":"P10","dim":"daily-life","text":"How confident are you about handling school meetings, doctor visits, and paperwork for your family?","reverse":false},
|
|
{"id":"P11","dim":"daily-life","text":"Does your family have the money and resources to cover your basic needs?","reverse":false},
|
|
{"id":"P12","dim":"daily-life","text":"Are you able to get the services and supports your family member with a disability needs?","reverse":false},
|
|
{"id":"P13","dim":"purpose","text":"Do you feel accepted and respected by the professionals who work with your family?","reverse":false},
|
|
{"id":"P14","dim":"purpose","text":"How often do you feel like your role as a caregiver gives your life meaning?","reverse":false},
|
|
{"id":"P15","dim":"purpose","text":"Is there anything outside of caregiving that is important to who you are?","reverse":false},
|
|
{"id":"P16","dim":"growth","text":"Are you learning new things about how to support your family member?","reverse":false},
|
|
{"id":"P17","dim":"growth","text":"How often do you feel stuck or like nothing you do makes a difference?","reverse":true},
|
|
{"id":"P18","dim":"growth","text":"In the past month, have you done anything just for you (a class, a hobby, time with a friend)?","reverse":false}
|
|
]
|
|
},
|
|
"family-member": {
|
|
"title": "Family Member",
|
|
"subtitle": "For household members of people with disabilities",
|
|
"scale": ["Very satisfied", "Satisfied", "Neither satisfied nor dissatisfied", "Dissatisfied"],
|
|
"emoji": null,
|
|
"items": [
|
|
{"id":"F1","dim":"physical","text":"Do members of your family get the medical care they need when they need it?","reverse":false},
|
|
{"id":"F2","dim":"physical","text":"Does your family feel safe at home, work, school, and in the neighborhood?","reverse":false},
|
|
{"id":"F3","dim":"physical","text":"Does your family have transportation to get to the places you need to be?","reverse":false},
|
|
{"id":"F4","dim":"emotional","text":"Does your family have the support you need to handle stress?","reverse":false},
|
|
{"id":"F5","dim":"emotional","text":"Do family members have some time to pursue their own interests?","reverse":false},
|
|
{"id":"F6","dim":"emotional","text":"Do family members have outside help available for special needs?","reverse":false},
|
|
{"id":"F7","dim":"social","text":"Do family members have friends or others outside the home they can lean on?","reverse":false},
|
|
{"id":"F8","dim":"social","text":"Does your family enjoy spending time together?","reverse":false},
|
|
{"id":"F9","dim":"social","text":"Do family members show that they love and care for each other?","reverse":false},
|
|
{"id":"F10","dim":"daily-life","text":"Are you able to get the services and supports your family member with a disability needs?","reverse":false},
|
|
{"id":"F11","dim":"daily-life","text":"Does your family have a way to take care of expenses?","reverse":false},
|
|
{"id":"F12","dim":"daily-life","text":"Does your family have a good relationship with the service providers who work with your family member?","reverse":false},
|
|
{"id":"F13","dim":"purpose","text":"Does your family solve problems together?","reverse":false},
|
|
{"id":"F14","dim":"purpose","text":"Do family members support each other to accomplish goals?","reverse":false},
|
|
{"id":"F15","dim":"purpose","text":"Does your family feel like it is handling life's ups and downs well?","reverse":false},
|
|
{"id":"F16","dim":"growth","text":"Do family members help the children learn to be independent?","reverse":false},
|
|
{"id":"F17","dim":"growth","text":"Do adults in the family know other people in the children's lives (friends, teachers)?","reverse":false},
|
|
{"id":"F18","dim":"growth","text":"Do family members talk openly with each other?","reverse":false}
|
|
]
|
|
},
|
|
"professional": {
|
|
"title": "Professional",
|
|
"subtitle": "For therapists, counselors, educators, and healthcare workers",
|
|
"scale": ["Almost every day", "Several days a week", "Once in a while", "Rarely"],
|
|
"emoji": null,
|
|
"items": [
|
|
{"id":"PR1","dim":"physical","text":"How often do you feel physically drained after your workday?","reverse":true},
|
|
{"id":"PR2","dim":"physical","text":"In the past month, how often have you lost sleep over the experiences of people you help?","reverse":true},
|
|
{"id":"PR3","dim":"physical","text":"How often do you feel on edge or jumpy because of things you hear at work?","reverse":true},
|
|
{"id":"PR4","dim":"emotional","text":"I find my work as a helper to be deeply satisfying.","reverse":false},
|
|
{"id":"PR5","dim":"emotional","text":"How often do you feel depressed because of the experiences of people you help?","reverse":true},
|
|
{"id":"PR6","dim":"emotional","text":"How often do you feel overwhelmed because your workload seems endless?","reverse":true},
|
|
{"id":"PR7","dim":"social","text":"Do you have colleagues or peers you can talk with honestly about difficult cases?","reverse":false},
|
|
{"id":"PR8","dim":"social","text":"How often do you feel connected to the people around you at work?","reverse":false},
|
|
{"id":"PR9","dim":"social","text":"How often do you feel trapped by your job?","reverse":true},
|
|
{"id":"PR10","dim":"daily-life","text":"How well do you maintain a boundary between your work and your personal life?","reverse":false},
|
|
{"id":"PR11","dim":"daily-life","text":"I am pleased with how I keep up with professional techniques and protocols.","reverse":false},
|
|
{"id":"PR12","dim":"daily-life","text":"How often do you feel bogged down by the systems and rules at work?","reverse":true},
|
|
{"id":"PR13","dim":"purpose","text":"I believe I can make a difference through my work.","reverse":false},
|
|
{"id":"PR14","dim":"purpose","text":"How often do you have happy thoughts about the people you help?","reverse":false},
|
|
{"id":"PR15","dim":"purpose","text":"Are you happy that you chose this line of work?","reverse":false},
|
|
{"id":"PR16","dim":"growth","text":"I am pleased with how I am able to keep up with helping techniques and protocols.","reverse":false},
|
|
{"id":"PR17","dim":"growth","text":"How often do you avoid situations that remind you of frightening things people you help have told you?","reverse":true},
|
|
{"id":"PR18","dim":"growth","text":"Are you the person you always wanted to be in this work?","reverse":false}
|
|
]
|
|
},
|
|
"special-needs": {
|
|
"title": "Accessible",
|
|
"subtitle": "For people with disabilities (a support person may help you read)",
|
|
"scale": ["Not Good", "Okay", "Pretty Good", "Good", "Very Good"],
|
|
"emoji": ["😟", "😐", "🙂", "😊", "😄"],
|
|
"items": [
|
|
{"id":"SN1","dim":"physical","text":"How do you feel about your health?","reverse":false},
|
|
{"id":"SN2","dim":"physical","text":"How do you feel about how safe you feel?","reverse":false},
|
|
{"id":"SN3","dim":"emotional","text":"In the past two weeks, how often have you felt happy?","reverse":false},
|
|
{"id":"SN4","dim":"emotional","text":"In the past two weeks, how often have you felt calm?","reverse":false},
|
|
{"id":"SN5","dim":"social","text":"How do you feel about how you get along with people? Like your family and friends.","reverse":false},
|
|
{"id":"SN6","dim":"social","text":"How do you feel about doing things outside your home? Like in your community or neighborhood.","reverse":false},
|
|
{"id":"SN7","dim":"daily-life","text":"How do you feel about the things you have? Like your money and the things you own.","reverse":false},
|
|
{"id":"SN8","dim":"daily-life","text":"How do you feel about how your day goes? Like your routine and what you do.","reverse":false},
|
|
{"id":"SN9","dim":"purpose","text":"How do you feel about the things you do or make?","reverse":false},
|
|
{"id":"SN10","dim":"purpose","text":"How do you feel about your life as a whole?","reverse":false},
|
|
{"id":"SN11","dim":"growth","text":"How do you feel about what will happen to you later in your life?","reverse":false},
|
|
{"id":"SN12","dim":"growth","text":"In the past two weeks, how often have you felt like doing things?","reverse":false}
|
|
]
|
|
}
|
|
};
|
|
|
|
const DIMS = [
|
|
{"key":"physical","label":"Physical","icon":"💪","color":"#1565C0","bg":"#E3F2FD","desc":"rest, movement, nutrition, medical care"},
|
|
{"key":"emotional","label":"Emotional","icon":"💗","color":"#7B1FA2","bg":"#F3E5F5","desc":"naming feelings, coping, support"},
|
|
{"key":"social","label":"Social","icon":"🤝","color":"#2E7D32","bg":"#E8F5E9","desc":"connection, understanding, community"},
|
|
{"key":"daily-life","label":"Daily Life","icon":"📋","color":"#E65100","bg":"#FFF3E0","desc":"home, finances, schedules, advocacy"},
|
|
{"key":"purpose","label":"Purpose","icon":"⭐","color":"#F57F17","bg":"#FFF8E1","desc":"meaning, values, identity, hope"},
|
|
{"key":"growth","label":"Growth","icon":"🌱","color":"#C62828","bg":"#FFEBEE","desc":"learning, creativity, becoming"}
|
|
];
|
|
|
|
// Resource connector database
|
|
// Maps dimension → array of {name, desc, url, audiences (null=all)}
|
|
const RESOURCES = {
|
|
"physical": [
|
|
{"name":"Find a Medical Provider","desc":"Search for doctors, specialists, and therapists near you who accept your insurance.","url":"https://specialneeds.help/category/medical","audiences":null},
|
|
{"name":"Respite Care Services","desc":"Connect with respite care providers who can give you a break when you need it most.","url":"https://specialneeds.help/category/respite","audiences":["parent-caregiver","family-member"]},
|
|
{"name":"Adaptive Recreation Programs","desc":"Discover sports, fitness, and movement programs designed for people with disabilities.","url":"https://specialneeds.help/category/recreation","audiences":["special-needs","generalized"]},
|
|
{"name":"Sleep and Rest Resources","desc":"Practical strategies and support for improving sleep quality and managing fatigue.","url":"https://helpipedia.org/resources/sleep","audiences":null},
|
|
{"name":"Nutrition and Wellness","desc":"Find nutritionists, meal programs, and wellness resources for your family.","url":"https://specialneeds.help/category/nutrition","audiences":null}
|
|
],
|
|
"emotional": [
|
|
{"name":"Find a Counselor or Therapist","desc":"Search for mental health providers who understand disability and caregiver needs.","url":"https://specialneeds.help/category/counseling","audiences":null},
|
|
{"name":"Caregiver Support Groups","desc":"Connect with other caregivers who understand what you are going through.","url":"https://helpipedia.org/community/caregiver-support","audiences":["parent-caregiver","family-member"]},
|
|
{"name":"Crisis Support Lines","desc":"24/7 support when you need someone to talk to right now.","url":"https://helpipedia.org/resources/crisis","audiences":null},
|
|
{"name":"Stress Management Tools","desc":"Practical tools and techniques for managing stress, worry, and emotional overload.","url":"https://helpipedia.org/resources/stress","audiences":null},
|
|
{"name":"Professional Burnout Prevention","desc":"Resources specifically for helping professionals experiencing compassion fatigue.","url":"https://helpipedia.org/resources/burnout","audiences":["professional"]}
|
|
],
|
|
"social": [
|
|
{"name":"Parent Mentor Program","desc":"Get matched with an experienced parent who has walked a similar path.","url":"https://helpipedia.org/community/mentors","audiences":["parent-caregiver","family-member"]},
|
|
{"name":"Local Support Networks","desc":"Find community groups, meetups, and events near you.","url":"https://specialneeds.help/category/community","audiences":null},
|
|
{"name":"Peer Matching for Individuals","desc":"Connect with other people with disabilities who share your interests.","url":"https://helpipedia.org/community/peer-matching","audiences":["special-needs","generalized"]},
|
|
{"name":"Professional Peer Consultation","desc":"Find colleagues and supervision groups for case consultation and support.","url":"https://helpipedia.org/community/professional-peers","audiences":["professional"]},
|
|
{"name":"Family Activities and Events","desc":"Discover inclusive events and activities your whole family can enjoy together.","url":"https://specialneeds.help/category/events","audiences":null}
|
|
],
|
|
"daily-life": [
|
|
{"name":"IEP and Advocacy Support","desc":"Get help navigating school meetings, IEPs, and educational rights.","url":"https://specialneeds.help/category/education","audiences":["parent-caregiver","family-member"]},
|
|
{"name":"Financial Assistance Guide","desc":"Find benefits, grants, and financial resources for families navigating disability.","url":"https://specialneeds.help/category/financial","audiences":null},
|
|
{"name":"Benefits Navigation","desc":"Help understanding and applying for SSI, Medicaid, waivers, and other benefits.","url":"https://helpipedia.org/resources/benefits","audiences":null},
|
|
{"name":"Legal Aid and Advocacy","desc":"Connect with legal resources for disability rights, housing, and discrimination.","url":"https://specialneeds.help/category/legal","audiences":null},
|
|
{"name":"Daily Living Tools","desc":"Apps, planners, and practical tools for managing schedules, forms, and routines.","url":"https://helpipedia.org/resources/daily-tools","audiences":null}
|
|
],
|
|
"purpose": [
|
|
{"name":"Faith and Spirituality","desc":"Find inclusive faith communities and spiritual support resources.","url":"https://specialneeds.help/category/faith","audiences":null},
|
|
{"name":"Identity Beyond Caregiving","desc":"Resources to help you reconnect with who you are outside your caregiving role.","url":"https://helpipedia.org/resources/identity","audiences":["parent-caregiver","family-member"]},
|
|
{"name":"Disability-Affirming Organizations","desc":"Connect with organizations that celebrate disability identity and culture.","url":"https://specialneeds.help/category/community","audiences":["special-needs","generalized"]},
|
|
{"name":"Meaning and Purpose Coaching","desc":"Work with a coach to explore what gives your life meaning and direction.","url":"https://helpipedia.org/community/coaching","audiences":null},
|
|
{"name":"Storytelling and Advocacy Platforms","desc":"Share your story or learn from others navigating similar journeys.","url":"https://helpipedia.org/community/stories","audiences":null}
|
|
],
|
|
"growth": [
|
|
{"name":"Training and Workshops","desc":"Find training on disability topics, advocacy skills, and personal development.","url":"https://helpipedia.org/resources/training","audiences":null},
|
|
{"name":"Continuing Education","desc":"Courses and certifications for professionals working with the disability community.","url":"https://helpipedia.org/resources/continuing-ed","audiences":["professional"]},
|
|
{"name":"Creative and Hobby Programs","desc":"Discover art, music, and creative programs for individuals with disabilities.","url":"https://specialneeds.help/category/creative","audiences":["special-needs","generalized"]},
|
|
{"name":"Transition Planning Resources","desc":"Tools and guidance for planning life transitions at any age.","url":"https://specialneeds.help/category/transition","audiences":null},
|
|
{"name":"Podcasts and Media","desc":"Curated podcasts, videos, and reading lists from the disability and caregiver community.","url":"https://helpipedia.org/resources/media","audiences":null}
|
|
]
|
|
};
|
|
|
|
// ═══════════════════════════════════════════
|
|
// STATE
|
|
// ═══════════════════════════════════════════
|
|
|
|
let selectedAudience = null;
|
|
let currentQ = 0;
|
|
let answers = {};
|
|
let lastResults = null;
|
|
|
|
const STORAGE_KEY_PROGRESS = 'wow_progress';
|
|
const STORAGE_KEY_HISTORY = 'wow_history';
|
|
|
|
// ═══════════════════════════════════════════
|
|
// PERSISTENCE
|
|
// ═══════════════════════════════════════════
|
|
|
|
function saveProgress() {
|
|
if (!selectedAudience) return;
|
|
const data = {audience: selectedAudience, currentQ, answers, ts: Date.now()};
|
|
try { localStorage.setItem(STORAGE_KEY_PROGRESS, JSON.stringify(data)); } catch(e) {}
|
|
}
|
|
|
|
function loadProgress() {
|
|
try {
|
|
const raw = localStorage.getItem(STORAGE_KEY_PROGRESS);
|
|
if (!raw) return null;
|
|
const data = JSON.parse(raw);
|
|
if (Date.now() - data.ts > 24 * 60 * 60 * 1000) { clearProgress(); return null; }
|
|
if (data.answers && Object.keys(data.answers).length > 0) return data;
|
|
} catch(e) {}
|
|
return null;
|
|
}
|
|
|
|
function clearProgress() {
|
|
try { localStorage.removeItem(STORAGE_KEY_PROGRESS); } catch(e) {}
|
|
}
|
|
|
|
function saveResultsToHistory(results, overall, audience) {
|
|
try {
|
|
const raw = localStorage.getItem(STORAGE_KEY_HISTORY);
|
|
const history = raw ? JSON.parse(raw) : [];
|
|
history.unshift({
|
|
audience, overall,
|
|
results: results.map(r => ({key: r.key, label: r.label, score: r.score, status: r.status})),
|
|
date: new Date().toISOString(),
|
|
ts: Date.now()
|
|
});
|
|
if (history.length > 10) history.length = 10;
|
|
localStorage.setItem(STORAGE_KEY_HISTORY, JSON.stringify(history));
|
|
} catch(e) {}
|
|
}
|
|
|
|
function loadHistory() {
|
|
try {
|
|
const raw = localStorage.getItem(STORAGE_KEY_HISTORY);
|
|
return raw ? JSON.parse(raw) : [];
|
|
} catch(e) { return []; }
|
|
}
|
|
|
|
// ═══════════════════════════════════════════
|
|
// RESOURCE MATCHING
|
|
// ═══════════════════════════════════════════
|
|
|
|
function getRecommendedResources(results, audience) {
|
|
// Pick dimensions scoring below 60, sorted lowest first
|
|
const needsHelp = results
|
|
.filter(r => r.score < 60)
|
|
.sort((a, b) => a.score - b.score);
|
|
|
|
const matched = [];
|
|
const seen = new Set();
|
|
|
|
needsHelp.forEach(r => {
|
|
const pool = RESOURCES[r.key] || [];
|
|
pool.forEach(res => {
|
|
if (seen.has(res.name)) return;
|
|
if (res.audiences && !res.audiences.includes(audience)) return;
|
|
seen.add(res.name);
|
|
matched.push({...res, dimKey: r.key, dimLabel: r.label, dimColor: r.color, score: r.score});
|
|
});
|
|
});
|
|
|
|
// If we have room, add some from moderate dimensions too
|
|
if (matched.length < 4) {
|
|
const moderate = results.filter(r => r.score >= 60 && r.score < 75);
|
|
moderate.forEach(r => {
|
|
const pool = RESOURCES[r.key] || [];
|
|
pool.forEach(res => {
|
|
if (seen.has(res.name)) return;
|
|
if (res.audiences && !res.audiences.includes(audience)) return;
|
|
seen.add(res.name);
|
|
matched.push({...res, dimKey: r.key, dimLabel: r.label, dimColor: r.color, score: r.score});
|
|
});
|
|
});
|
|
}
|
|
|
|
return matched.slice(0, 8);
|
|
}
|
|
|
|
// ═══════════════════════════════════════════
|
|
// AUDIENCE SELECTOR
|
|
// ═══════════════════════════════════════════
|
|
|
|
const icons = {'generalized':'👤','parent-caregiver':'👨👩👧','family-member':'🏠','professional':'🩺','special-needs':'♿'};
|
|
|
|
function buildAudienceGrid() {
|
|
const grid = document.getElementById('audience-grid');
|
|
grid.innerHTML = '';
|
|
Object.entries(QUESTIONS).forEach(([key, q]) => {
|
|
const card = document.createElement('div');
|
|
card.className = 'audience-card';
|
|
card.dataset.key = key;
|
|
card.innerHTML = `<div class="aud-icon">${icons[key]||'👤'}</div><div class="aud-title">${q.title}</div><div class="aud-desc">${q.subtitle}</div>`;
|
|
card.onclick = () => selectAudience(key);
|
|
grid.appendChild(card);
|
|
});
|
|
}
|
|
|
|
function selectAudience(key) {
|
|
selectedAudience = key;
|
|
document.querySelectorAll('.audience-card').forEach(c => c.classList.toggle('selected', c.dataset.key === key));
|
|
document.getElementById('btn-start').disabled = false;
|
|
}
|
|
|
|
// ═══════════════════════════════════════════
|
|
// LANDING WHEEL SVG
|
|
// ═══════════════════════════════════════════
|
|
|
|
function drawLandingWheel() {
|
|
const svg = document.getElementById('landing-wheel');
|
|
const cx = 120, cy = 120, r = 90, inner = 40;
|
|
let paths = '';
|
|
DIMS.forEach((d, i) => {
|
|
const a1 = (i * 60 - 90) * Math.PI / 180;
|
|
const a2 = ((i + 1) * 60 - 90) * Math.PI / 180;
|
|
const x1 = cx + r * Math.cos(a1), y1 = cy + r * Math.sin(a1);
|
|
const x2 = cx + r * Math.cos(a2), y2 = cy + r * Math.sin(a2);
|
|
const ix1 = cx + inner * Math.cos(a1), iy1 = cy + inner * Math.sin(a1);
|
|
const ix2 = cx + inner * Math.cos(a2), iy2 = cy + inner * Math.sin(a2);
|
|
paths += `<path d="M${ix1},${iy1} L${x1},${y1} A${r},${r} 0 0,1 ${x2},${y2} L${ix2},${iy2} A${inner},${inner} 0 0,0 ${ix1},${iy1}" fill="${d.color}" opacity=".8"/>`;
|
|
const mx = cx + (r + inner) / 2 * Math.cos((a1 + a2) / 2);
|
|
const my = cy + (r + inner) / 2 * Math.sin((a1 + a2) / 2);
|
|
paths += `<text x="${mx}" y="${my}" text-anchor="middle" dominant-baseline="central" fill="white" font-size="12" font-weight="700">${d.icon}</text>`;
|
|
});
|
|
svg.innerHTML = paths + `<circle cx="${cx}" cy="${cy}" r="${inner - 4}" fill="var(--cream)"/><text x="${cx}" y="${cy}" text-anchor="middle" dominant-baseline="central" font-size="20">☸</text>`;
|
|
}
|
|
|
|
// ═══════════════════════════════════════════
|
|
// NAVIGATION
|
|
// ═══════════════════════════════════════════
|
|
|
|
function showScreen(name) {
|
|
document.querySelectorAll('.screen').forEach(s => s.classList.remove('active'));
|
|
document.getElementById('screen-' + name).classList.add('active');
|
|
window.scrollTo(0, 0);
|
|
}
|
|
|
|
function startAssessment() {
|
|
if (!selectedAudience) return;
|
|
currentQ = 0;
|
|
answers = {};
|
|
showScreen('questions');
|
|
renderQuestion();
|
|
saveProgress();
|
|
}
|
|
|
|
function resumeAssessment() {
|
|
const saved = loadProgress();
|
|
if (!saved) return;
|
|
selectedAudience = saved.audience;
|
|
currentQ = saved.currentQ;
|
|
answers = saved.answers || {};
|
|
document.getElementById('btn-start').disabled = false;
|
|
showScreen('questions');
|
|
renderQuestion();
|
|
}
|
|
|
|
// ═══════════════════════════════════════════
|
|
// QUESTION RENDERING
|
|
// ═══════════════════════════════════════════
|
|
|
|
function renderQuestion() {
|
|
const items = QUESTIONS[selectedAudience].items;
|
|
const item = items[currentQ];
|
|
const dim = DIMS.find(d => d.key === item.dim);
|
|
const total = items.length;
|
|
const scale = QUESTIONS[selectedAudience].scale;
|
|
const emojis = QUESTIONS[selectedAudience].emoji;
|
|
|
|
document.getElementById('dim-label').textContent = dim.icon + ' ' + dim.label;
|
|
document.getElementById('q-count').textContent = `Question ${currentQ + 1} of ${total}`;
|
|
document.getElementById('progress-fill').style.width = `${((currentQ + 1) / total) * 100}%`;
|
|
|
|
const di = document.getElementById('dim-indicator');
|
|
di.innerHTML = '';
|
|
DIMS.forEach(d => {
|
|
const dot = document.createElement('div');
|
|
dot.className = 'dim-dot' + (d.key === item.dim ? ' active' : '');
|
|
dot.style.background = d.color;
|
|
dot.title = d.label;
|
|
di.appendChild(dot);
|
|
});
|
|
|
|
const area = document.getElementById('question-area');
|
|
let optionsHtml = scale.map((s, i) => {
|
|
const selected = answers[item.id] === i ? ' selected' : '';
|
|
const emoji = emojis ? `<span class="opt-emoji">${emojis[i]}</span>` : '';
|
|
return `<div class="option-item${selected}" onclick="selectOption('${item.id}',${i})"><div class="radio-circle"></div>${emoji}<span>${s}</span></div>`;
|
|
}).join('');
|
|
|
|
area.innerHTML = `<div class="question-card"><div class="q-dim-label" style="color:${dim.color}">${dim.label}</div><div class="q-number">${item.id}</div><div class="q-text">${item.text}</div><div class="options-list">${optionsHtml}</div></div>`;
|
|
|
|
document.getElementById('btn-prev').style.visibility = currentQ === 0 ? 'hidden' : 'visible';
|
|
const nextBtn = document.getElementById('btn-next');
|
|
if (currentQ === total - 1) {
|
|
nextBtn.outerHTML = `<button class="btn-submit" id="btn-next" onclick="submitAssessment()" ${answers[item.id] === undefined ? 'disabled' : ''}>See My Results →</button>`;
|
|
} else {
|
|
nextBtn.disabled = answers[item.id] === undefined;
|
|
}
|
|
|
|
saveProgress();
|
|
}
|
|
|
|
function selectOption(qId, val) {
|
|
answers[qId] = val;
|
|
renderQuestion();
|
|
}
|
|
|
|
function nextQuestion() {
|
|
const items = QUESTIONS[selectedAudience].items;
|
|
if (currentQ < items.length - 1) { currentQ++; renderQuestion(); }
|
|
}
|
|
|
|
function prevQuestion() {
|
|
if (currentQ > 0) { currentQ--; renderQuestion(); }
|
|
}
|
|
|
|
// ═══════════════════════════════════════════
|
|
// SCORING
|
|
// ═══════════════════════════════════════════
|
|
|
|
function scoreAssessment() {
|
|
const items = QUESTIONS[selectedAudience].items;
|
|
const scaleLen = QUESTIONS[selectedAudience].scale.length;
|
|
const dimScores = {};
|
|
DIMS.forEach(d => { dimScores[d.key] = {sum: 0, count: 0}; });
|
|
|
|
items.forEach(item => {
|
|
const val = answers[item.id];
|
|
if (val === undefined) return;
|
|
const score = item.reverse ? (scaleLen - 1 - val) : val;
|
|
dimScores[item.dim].sum += score;
|
|
dimScores[item.dim].count += 1;
|
|
});
|
|
|
|
const results = DIMS.map(d => {
|
|
const {sum, count} = dimScores[d.key];
|
|
const raw = count > 0 ? (sum / count) / (scaleLen - 1) * 100 : 0;
|
|
const score = Math.round(raw);
|
|
let status = 'strong';
|
|
if (score < 40) status = 'needs-attention';
|
|
else if (score < 60) status = 'moderate';
|
|
return {...d, score, status};
|
|
});
|
|
|
|
const overall = Math.round(results.reduce((s, r) => s + r.score, 0) / results.length);
|
|
let overallStatus = 'Strong';
|
|
if (overall < 40) overallStatus = 'Needs Attention';
|
|
else if (overall < 60) overallStatus = 'Moderate';
|
|
return {results, overall, overallStatus};
|
|
}
|
|
|
|
// ═══════════════════════════════════════════
|
|
// RESULTS RENDERING
|
|
// ═══════════════════════════════════════════
|
|
|
|
function submitAssessment() {
|
|
const {results, overall, overallStatus} = scoreAssessment();
|
|
lastResults = {results, overall, overallStatus, audience: selectedAudience};
|
|
|
|
clearProgress();
|
|
saveResultsToHistory(results, overall, selectedAudience);
|
|
renderResults(results, overall, overallStatus, selectedAudience);
|
|
showScreen('results');
|
|
}
|
|
|
|
function renderResults(results, overall, overallStatus, audience) {
|
|
// Summary
|
|
const countNeedsAttention = results.filter(r => r.status === 'needs-attention').length;
|
|
const countModerate = results.filter(r => r.status === 'moderate').length;
|
|
let summaryText = `Your overall wellness score is ${overall}/100 (${overallStatus}). `;
|
|
if (countNeedsAttention > 0) {
|
|
summaryText += `${countNeedsAttention} area${countNeedsAttention > 1 ? 's' : ''} could use attention. `;
|
|
}
|
|
if (countModerate > 0) {
|
|
summaryText += `${countModerate} area${countModerate > 1 ? 's are' : ' is'} in the moderate range. `;
|
|
}
|
|
summaryText += 'Scroll down for resources matched to your needs.';
|
|
document.getElementById('results-summary').textContent = summaryText;
|
|
|
|
// Dim cards
|
|
const grid = document.getElementById('results-grid');
|
|
grid.innerHTML = results.map(r => `
|
|
<div class="dim-card" style="border-left:3px solid ${r.color}">
|
|
<div class="dim-card-header">
|
|
<span class="dim-card-name"><span class="dim-icon">${r.icon}</span> ${r.label}</span>
|
|
<span class="status-badge ${r.status}">${r.status.replace('-', ' ')}</span>
|
|
</div>
|
|
<div class="dim-score-text" style="color:${r.color}">${r.score}</div>
|
|
<div class="dim-desc">${r.desc}</div>
|
|
</div>
|
|
`).join('');
|
|
|
|
// Overall
|
|
const oc = document.getElementById('overall-score');
|
|
oc.textContent = overall;
|
|
oc.style.color = overall >= 60 ? 'var(--green)' : overall >= 40 ? '#F9A825' : 'var(--red)';
|
|
|
|
// Results wheel
|
|
drawResultsWheel(results);
|
|
|
|
// Resource recommendations
|
|
const resources = getRecommendedResources(results, audience);
|
|
const resSection = document.getElementById('resource-section');
|
|
const resList = document.getElementById('resource-list');
|
|
|
|
if (resources.length > 0) {
|
|
resSection.style.display = 'block';
|
|
const dim = DIMS.find(d => d.key === resources[0].dimKey);
|
|
resList.innerHTML = resources.map(r => `
|
|
<div class="resource-card" style="border-left-color:${r.dimColor}">
|
|
<div class="res-dim" style="color:${r.dimColor}">${r.dimLabel} · Score: ${r.score}</div>
|
|
<div class="res-name">${r.name}</div>
|
|
<div class="res-desc">${r.desc}</div>
|
|
<a class="res-link" href="${r.url}" target="_blank" rel="noopener">Visit resource →</a>
|
|
</div>
|
|
`).join('');
|
|
} else {
|
|
resSection.style.display = 'none';
|
|
}
|
|
|
|
// History
|
|
renderHistory();
|
|
}
|
|
|
|
function drawResultsWheel(results) {
|
|
const svg = document.getElementById('results-wheel');
|
|
const cx = 140, cy = 140, maxR = 120, inner = 30;
|
|
let paths = '';
|
|
|
|
// Background rings
|
|
let rings = '';
|
|
[25, 50, 75, 100].forEach(pct => {
|
|
const rr = inner + (maxR - inner) * pct / 100;
|
|
rings += `<circle cx="${cx}" cy="${cy}" r="${rr}" fill="none" stroke="var(--gray-200)" stroke-width="1" opacity=".5"/>`;
|
|
});
|
|
|
|
results.forEach((r, i) => {
|
|
const a1 = (i * 60 - 90) * Math.PI / 180;
|
|
const a2 = ((i + 1) * 60 - 90) * Math.PI / 180;
|
|
const segR = inner + (maxR - inner) * (r.score / 100);
|
|
const x1 = cx + segR * Math.cos(a1), y1 = cy + segR * Math.sin(a1);
|
|
const x2 = cx + segR * Math.cos(a2), y2 = cy + segR * Math.sin(a2);
|
|
const ix1 = cx + inner * Math.cos(a1), iy1 = cy + inner * Math.sin(a1);
|
|
const ix2 = cx + inner * Math.cos(a2), iy2 = cy + inner * Math.sin(a2);
|
|
paths += `<path d="M${ix1},${iy1} L${x1},${y1} A${segR},${segR} 0 0,1 ${x2},${y2} L${ix2},${iy2} A${inner},${inner} 0 0,0 ${ix1},${iy1}" fill="${r.color}" opacity=".85"/>`;
|
|
// Label
|
|
const labelR = maxR + 16;
|
|
const mx = cx + labelR * Math.cos((a1 + a2) / 2);
|
|
const my = cy + labelR * Math.sin((a1 + a2) / 2);
|
|
paths += `<text x="${mx}" y="${my}" text-anchor="middle" dominant-baseline="central" font-size="11" font-weight="600" fill="var(--charcoal)">${r.icon} ${r.score}</text>`;
|
|
});
|
|
|
|
svg.innerHTML = rings + paths + `<circle cx="${cx}" cy="${cy}" r="${inner}" fill="var(--cream)"/>`;
|
|
}
|
|
|
|
function renderHistory() {
|
|
const history = loadHistory();
|
|
const section = document.getElementById('history-section');
|
|
const list = document.getElementById('history-list');
|
|
|
|
if (history.length === 0) {
|
|
section.style.display = 'none';
|
|
return;
|
|
}
|
|
section.style.display = 'block';
|
|
list.innerHTML = history.map((h, i) => {
|
|
const d = new Date(h.date);
|
|
const dateStr = d.toLocaleDateString('en-US', {month:'short', day:'numeric', year:'numeric'});
|
|
const audienceName = QUESTIONS[h.audience] ? QUESTIONS[h.audience].title : h.audience;
|
|
return `<div class="history-item" onclick="viewHistoryItem(${i})">
|
|
<span class="hist-date">${dateStr}</span>
|
|
<span>${audienceName}</span>
|
|
<span class="hist-score">${h.overall}/100</span>
|
|
</div>`;
|
|
}).join('');
|
|
}
|
|
|
|
function viewHistoryItem(index) {
|
|
const history = loadHistory();
|
|
const h = history[index];
|
|
if (!h) return;
|
|
|
|
// Reconstruct full DIMS data for rendering
|
|
const results = h.results.map(r => {
|
|
const dim = DIMS.find(d => d.key === r.key);
|
|
return {...dim, score: r.score, status: r.status};
|
|
});
|
|
|
|
lastResults = {results, overall: h.overall, audience: h.audience};
|
|
renderResults(results, h.overall,
|
|
h.overall >= 60 ? 'Strong' : h.overall >= 40 ? 'Moderate' : 'Needs Attention',
|
|
h.audience);
|
|
showScreen('results');
|
|
}
|
|
|
|
// ═══════════════════════════════════════════
|
|
// SHARE / EXPORT
|
|
// ═══════════════════════════════════════════
|
|
|
|
function shareResults() {
|
|
if (!lastResults) return;
|
|
const {results, overall, audience} = lastResults;
|
|
const audienceName = QUESTIONS[audience] ? QUESTIONS[audience].title : audience;
|
|
const dimSummary = results.map(r => `${r.icon} ${r.label}: ${r.score}/100 (${r.status.replace('-',' ')})`).join('\n');
|
|
const text = `Wheel of Wellness Results\nAudience: ${audienceName}\nOverall: ${overall}/100\n\n${dimSummary}\n\nTake the assessment: ${window.location.href}`;
|
|
|
|
if (navigator.share) {
|
|
navigator.share({title: 'My Wheel of Wellness Results', text}).catch(() => {});
|
|
} else {
|
|
navigator.clipboard.writeText(text).then(() => {
|
|
alert('Results copied to clipboard!');
|
|
}).catch(() => {
|
|
prompt('Copy your results:', text);
|
|
});
|
|
}
|
|
}
|
|
|
|
// ═══════════════════════════════════════════
|
|
// RETAKING
|
|
// ═══════════════════════════════════════════
|
|
|
|
function retake() {
|
|
answers = {};
|
|
currentQ = 0;
|
|
selectedAudience = null;
|
|
lastResults = null;
|
|
clearProgress();
|
|
document.querySelectorAll('.audience-card').forEach(c => c.classList.remove('selected'));
|
|
document.getElementById('btn-start').disabled = true;
|
|
showScreen('landing');
|
|
}
|
|
|
|
// ═══════════════════════════════════════════
|
|
// INIT
|
|
// ═══════════════════════════════════════════
|
|
|
|
function init() {
|
|
buildAudienceGrid();
|
|
drawLandingWheel();
|
|
|
|
// Check for saved progress
|
|
const saved = loadProgress();
|
|
if (saved && saved.audience && saved.answers && Object.keys(saved.answers).length > 0) {
|
|
const banner = document.getElementById('saved-banner');
|
|
banner.classList.add('visible');
|
|
// Pre-select the audience
|
|
const q = QUESTIONS[saved.audience];
|
|
if (q) {
|
|
banner.innerHTML = `📋 You have a saved ${q.title} assessment in progress (${Object.keys(saved.answers).length} questions answered). Click here to continue.`;
|
|
}
|
|
}
|
|
}
|
|
|
|
init();
|
|
</script>
|
|
</body>
|
|
</html> |