add mock
Browse files- open-question-mock.html +283 -0
open-question-mock.html
ADDED
|
@@ -0,0 +1,283 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!doctype html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="utf-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
| 6 |
+
<title>Mathly — Open question phone scan</title>
|
| 7 |
+
<style>
|
| 8 |
+
:root {
|
| 9 |
+
color-scheme: dark;
|
| 10 |
+
--bg: #080a09;
|
| 11 |
+
--panel: #121513;
|
| 12 |
+
--panel-2: #191d1a;
|
| 13 |
+
--line: #303632;
|
| 14 |
+
--text: #f5f2ea;
|
| 15 |
+
--muted: #9ba49e;
|
| 16 |
+
--blue: #83aaf5;
|
| 17 |
+
--blue-soft: #19253c;
|
| 18 |
+
--green: #79c991;
|
| 19 |
+
--purple: #b99bed;
|
| 20 |
+
--yellow: #e2bb63;
|
| 21 |
+
--shadow: 0 24px 80px rgba(0,0,0,.42);
|
| 22 |
+
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
| 23 |
+
}
|
| 24 |
+
* { box-sizing: border-box; }
|
| 25 |
+
body {
|
| 26 |
+
margin: 0;
|
| 27 |
+
min-height: 100vh;
|
| 28 |
+
color: var(--text);
|
| 29 |
+
background:
|
| 30 |
+
radial-gradient(circle at 16% 12%, rgba(131,170,245,.12), transparent 27rem),
|
| 31 |
+
radial-gradient(circle at 88% 90%, rgba(185,155,237,.09), transparent 24rem),
|
| 32 |
+
var(--bg);
|
| 33 |
+
}
|
| 34 |
+
button { font: inherit; }
|
| 35 |
+
.page { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding: 34px 0 46px; }
|
| 36 |
+
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
|
| 37 |
+
.brand { display: flex; align-items: center; gap: 12px; font-weight: 760; letter-spacing: -.02em; }
|
| 38 |
+
.brand-mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--blue); color: #09111f; font: 800 23px Georgia, serif; transform: rotate(-3deg); }
|
| 39 |
+
.prototype { padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
|
| 40 |
+
.layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .7fr); align-items: center; gap: clamp(32px, 6vw, 82px); }
|
| 41 |
+
.browser { border: 1px solid var(--line); border-radius: 22px; overflow: hidden; background: var(--panel); box-shadow: var(--shadow); }
|
| 42 |
+
.browser-bar { height: 48px; display: flex; align-items: center; gap: 7px; padding: 0 16px; background: #0e100f; border-bottom: 1px solid var(--line); }
|
| 43 |
+
.dot { width: 9px; height: 9px; border-radius: 50%; background: #444a46; }
|
| 44 |
+
.url { margin: auto; width: min(280px, 56%); padding: 6px 12px; background: #171a18; color: #68716b; border-radius: 7px; text-align: center; font-size: 11px; }
|
| 45 |
+
.desktop { min-height: 570px; padding: clamp(24px, 5vw, 48px); display: flex; flex-direction: column; }
|
| 46 |
+
.lesson-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
|
| 47 |
+
.lesson-meta span:first-child { color: var(--purple); border: 1px solid var(--purple); border-radius: 99px; padding: 4px 9px; font-weight: 650; }
|
| 48 |
+
.progress { margin-left: auto; }
|
| 49 |
+
h1 { margin: 28px 0 8px; font: 500 clamp(24px, 4vw, 36px)/1.16 Georgia, "Times New Roman", serif; letter-spacing: -.025em; }
|
| 50 |
+
.instruction { color: var(--muted); margin: 0 0 25px; font-size: 14px; }
|
| 51 |
+
.problem { display: grid; grid-template-columns: 1fr 210px; gap: 28px; align-items: center; padding: 23px; background: #0d0f0e; border: 1px solid var(--line); border-radius: 16px; }
|
| 52 |
+
.problem p { margin: 0; line-height: 1.65; }
|
| 53 |
+
.problem strong { color: var(--yellow); }
|
| 54 |
+
.diagram { width: 100%; height: auto; }
|
| 55 |
+
.answer-area { margin-top: 18px; border: 1.5px dashed #46504a; border-radius: 16px; min-height: 138px; display: grid; place-items: center; padding: 18px; text-align: center; transition: .25s ease; }
|
| 56 |
+
.answer-area.received { border-style: solid; border-color: var(--green); background: rgba(121,201,145,.06); grid-template-columns: 100px 1fr; text-align: left; gap: 18px; }
|
| 57 |
+
.answer-area .empty-icon { font-size: 25px; color: var(--muted); }
|
| 58 |
+
.answer-area p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
|
| 59 |
+
.answer-preview { display: none; width: 100px; height: 94px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: #efe8db; }
|
| 60 |
+
.received .answer-preview { display: block; }
|
| 61 |
+
.received .empty-icon { display: none; }
|
| 62 |
+
.answer-copy strong { display: block; color: var(--green); margin-bottom: 4px; }
|
| 63 |
+
.actions { margin-top: auto; padding-top: 22px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
|
| 64 |
+
.status { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
|
| 65 |
+
.status i { width: 8px; height: 8px; background: var(--muted); border-radius: 50%; }
|
| 66 |
+
.status.waiting i { background: var(--yellow); box-shadow: 0 0 0 5px rgba(226,187,99,.1); animation: pulse 1.5s infinite; }
|
| 67 |
+
.status.done i { background: var(--green); }
|
| 68 |
+
.primary, .secondary, .phone-button { border: 0; border-radius: 999px; cursor: pointer; font-weight: 720; transition: transform .15s, opacity .15s, background .15s; }
|
| 69 |
+
.primary { padding: 13px 20px; background: var(--blue); color: #07111f; }
|
| 70 |
+
.primary:hover, .phone-button:hover { transform: translateY(-1px); }
|
| 71 |
+
.primary:disabled { opacity: .45; cursor: default; transform: none; }
|
| 72 |
+
.phone-wrap { display: flex; flex-direction: column; align-items: center; }
|
| 73 |
+
.phone-label { margin: 0 0 13px; color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
|
| 74 |
+
.phone { width: min(310px, 100%); aspect-ratio: 9 / 18.3; border: 7px solid #333834; border-radius: 42px; padding: 7px; background: #050605; box-shadow: var(--shadow); position: relative; }
|
| 75 |
+
.phone::before { content: ""; position: absolute; z-index: 3; top: 12px; left: 50%; transform: translateX(-50%); width: 82px; height: 22px; border-radius: 999px; background: #050605; }
|
| 76 |
+
.screen { height: 100%; border-radius: 30px; overflow: hidden; background: var(--panel); position: relative; }
|
| 77 |
+
.phone-head { height: 66px; padding: 27px 16px 10px; display: flex; justify-content: space-between; font-size: 11px; background: #0d0f0e; }
|
| 78 |
+
.phone-content { height: calc(100% - 66px); padding: 22px 19px 18px; display: flex; flex-direction: column; text-align: center; }
|
| 79 |
+
.phone-logo { width: 45px; height: 45px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 14px; background: var(--blue); color: #07111f; font: 800 27px Georgia, serif; }
|
| 80 |
+
.phone h2 { margin: 0 0 10px; font-size: 21px; line-height: 1.2; }
|
| 81 |
+
.phone-copy { margin: 0; color: var(--muted); line-height: 1.5; font-size: 13px; }
|
| 82 |
+
.request-card { margin-top: 22px; padding: 15px; border: 1px solid var(--line); background: #0c0e0d; border-radius: 14px; text-align: left; }
|
| 83 |
+
.request-card small { color: var(--purple); font-weight: 700; }
|
| 84 |
+
.request-card b { display: block; margin-top: 6px; font-size: 14px; }
|
| 85 |
+
.request-card span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
|
| 86 |
+
.phone-actions { margin-top: auto; display: grid; gap: 9px; }
|
| 87 |
+
.phone-button { padding: 13px 16px; background: var(--blue); color: #07111f; width: 100%; }
|
| 88 |
+
.secondary { padding: 11px 16px; background: transparent; color: var(--muted); }
|
| 89 |
+
.camera { position: absolute; inset: 0; display: none; flex-direction: column; background: #101310; z-index: 2; }
|
| 90 |
+
.camera.show { display: flex; }
|
| 91 |
+
.viewfinder { flex: 1; position: relative; overflow: hidden; background: linear-gradient(135deg, #d7d0c2, #f4efe5); }
|
| 92 |
+
.paper { position: absolute; width: 82%; height: 63%; left: 9%; top: 17%; background: #fffdf7; color: #26231f; transform: rotate(-3deg); padding: 25px 20px; box-shadow: 0 7px 25px rgba(0,0,0,.25); font: 17px/1.8 "Comic Sans MS", cursive; text-align: left; }
|
| 93 |
+
.paper svg { width: 90%; height: 120px; display: block; margin: 4px auto; }
|
| 94 |
+
.corners::before, .corners::after { content: ""; position: absolute; inset: 12%; border: solid rgba(255,255,255,.92); border-width: 2px 0; pointer-events: none; }
|
| 95 |
+
.camera-top { position: absolute; inset: 0 0 auto; z-index: 2; display: flex; justify-content: space-between; padding: 30px 18px 12px; background: linear-gradient(#080a09bb, transparent); }
|
| 96 |
+
.camera-top button { border: 0; color: white; background: transparent; font-size: 22px; cursor: pointer; }
|
| 97 |
+
.camera-controls { height: 118px; display: flex; align-items: center; justify-content: space-around; background: #080a09; }
|
| 98 |
+
.shutter { width: 60px; height: 60px; border: 4px solid white; background: transparent; border-radius: 50%; padding: 5px; cursor: pointer; }
|
| 99 |
+
.shutter::after { content: ""; display: block; width: 100%; height: 100%; border-radius: 50%; background: white; }
|
| 100 |
+
.camera-tip { color: var(--muted); font-size: 11px; width: 68px; }
|
| 101 |
+
.review { position: absolute; inset: 0; z-index: 4; display: none; flex-direction: column; background: #0d0f0e; padding: 34px 18px 20px; text-align: center; }
|
| 102 |
+
.review.show { display: flex; }
|
| 103 |
+
.photo { height: 68%; border-radius: 13px; overflow: hidden; background: #e9e3d8; padding: 18px; transform: rotate(-1deg); color: #25221e; font: 16px/1.7 "Comic Sans MS", cursive; text-align: left; }
|
| 104 |
+
.photo svg { display: block; width: 90%; height: 135px; margin: 8px auto; }
|
| 105 |
+
.review p { color: var(--muted); font-size: 12px; margin: 13px 0; }
|
| 106 |
+
.review-actions { display: grid; grid-template-columns: .75fr 1.25fr; gap: 8px; margin-top: auto; }
|
| 107 |
+
.review-actions button { padding: 12px 8px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer; }
|
| 108 |
+
.review-actions .send { background: var(--blue); color: #07111f; border-color: var(--blue); font-weight: 750; }
|
| 109 |
+
.toast { position: absolute; left: 14px; right: 14px; bottom: 18px; z-index: 6; padding: 12px; border-radius: 12px; color: var(--green); background: #13271a; border: 1px solid #285637; font-size: 12px; text-align: center; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .25s; }
|
| 110 |
+
.toast.show { opacity: 1; transform: none; }
|
| 111 |
+
.helper { margin-top: 16px; max-width: 310px; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.5; }
|
| 112 |
+
@keyframes pulse { 50% { transform: scale(.65); } }
|
| 113 |
+
@media (max-width: 850px) {
|
| 114 |
+
.layout { grid-template-columns: 1fr; }
|
| 115 |
+
.phone-wrap { order: -1; }
|
| 116 |
+
.phone { width: 290px; }
|
| 117 |
+
.browser { max-width: 680px; margin: auto; }
|
| 118 |
+
}
|
| 119 |
+
@media (max-width: 560px) {
|
| 120 |
+
.page { width: min(100% - 20px, 1180px); padding-top: 18px; }
|
| 121 |
+
.problem { grid-template-columns: 1fr; }
|
| 122 |
+
.diagram { max-width: 220px; margin: auto; }
|
| 123 |
+
.desktop { padding: 22px 18px; }
|
| 124 |
+
.actions { align-items: stretch; flex-direction: column; }
|
| 125 |
+
.primary { width: 100%; }
|
| 126 |
+
}
|
| 127 |
+
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
|
| 128 |
+
</style>
|
| 129 |
+
</head>
|
| 130 |
+
<body>
|
| 131 |
+
<main class="page">
|
| 132 |
+
<header class="topbar">
|
| 133 |
+
<div class="brand"><span class="brand-mark">M</span><span>Mathly</span></div>
|
| 134 |
+
<span class="prototype">Interactive mock</span>
|
| 135 |
+
</header>
|
| 136 |
+
|
| 137 |
+
<div class="layout">
|
| 138 |
+
<section class="browser" aria-label="Student computer">
|
| 139 |
+
<div class="browser-bar"><i class="dot"></i><i class="dot"></i><i class="dot"></i><span class="url">app.mathly.com/practice</span></div>
|
| 140 |
+
<div class="desktop">
|
| 141 |
+
<div class="lesson-meta"><span>Geometry</span><span>Triangles & angles</span><span class="progress">4 of 8</span></div>
|
| 142 |
+
<h1>Find the value of <em>x</em>.</h1>
|
| 143 |
+
<p class="instruction">Show your reasoning. You can solve this question on paper and scan your answer.</p>
|
| 144 |
+
<div class="problem">
|
| 145 |
+
<p>In triangle <strong>ABC</strong>, angle A is 48° and angle B is 67°. Find angle C and explain how you know.</p>
|
| 146 |
+
<svg class="diagram" viewBox="0 0 240 170" role="img" aria-label="Triangle ABC with two labelled angles">
|
| 147 |
+
<path d="M28 143 L203 143 L126 25 Z" fill="none" stroke="#b99bed" stroke-width="3"/>
|
| 148 |
+
<path d="M47 143 A20 20 0 0 1 39 127" fill="none" stroke="#e2bb63" stroke-width="2"/>
|
| 149 |
+
<path d="M185 143 A20 20 0 0 0 193 127" fill="none" stroke="#e2bb63" stroke-width="2"/>
|
| 150 |
+
<text x="17" y="160" fill="#f5f2ea">A</text><text x="205" y="160" fill="#f5f2ea">B</text><text x="121" y="18" fill="#f5f2ea">C</text>
|
| 151 |
+
<text x="48" y="129" fill="#e2bb63" font-size="14">48°</text><text x="165" y="129" fill="#e2bb63" font-size="14">67°</text><text x="116" y="53" fill="#9ba49e">x</text>
|
| 152 |
+
</svg>
|
| 153 |
+
</div>
|
| 154 |
+
<div class="answer-area" id="answerArea" aria-live="polite">
|
| 155 |
+
<div class="empty-icon">⌁<p id="answerText">Your scanned work will appear here</p></div>
|
| 156 |
+
<svg class="answer-preview" viewBox="0 0 100 94" aria-label="Preview of scanned handwritten solution">
|
| 157 |
+
<rect width="100" height="94" fill="#fffdf7"/><path d="M18 64 L50 18 L82 64 Z" fill="none" stroke="#2b2925" stroke-width="2"/><text x="12" y="82" fill="#2b2925" font-size="9">x = 180−115 = 65°</text>
|
| 158 |
+
</svg>
|
| 159 |
+
<div class="answer-copy"><strong>Answer received</strong><p>Your handwritten solution was attached successfully.</p></div>
|
| 160 |
+
</div>
|
| 161 |
+
<div class="actions">
|
| 162 |
+
<div class="status" id="desktopStatus"><i></i><span>Not started</span></div>
|
| 163 |
+
<button class="primary" id="scanButton">Scan my answer with my phone</button>
|
| 164 |
+
</div>
|
| 165 |
+
</div>
|
| 166 |
+
</section>
|
| 167 |
+
|
| 168 |
+
<aside class="phone-wrap" aria-label="Student phone">
|
| 169 |
+
<p class="phone-label">Your phone</p>
|
| 170 |
+
<div class="phone">
|
| 171 |
+
<div class="screen">
|
| 172 |
+
<div class="phone-head"><span>9:41</span><span>● Wi-Fi ▰</span></div>
|
| 173 |
+
<div class="phone-content">
|
| 174 |
+
<div class="phone-logo">M</div>
|
| 175 |
+
<h2 id="phoneTitle">Ready when you are</h2>
|
| 176 |
+
<p class="phone-copy" id="phoneCopy">Start a scan request on your computer. It will appear here automatically.</p>
|
| 177 |
+
<div class="request-card" id="requestCard" hidden><small>Scan request</small><b>Geometry · Question 4</b><span>Requested by you just now</span></div>
|
| 178 |
+
<div class="phone-actions" id="phoneActions" hidden>
|
| 179 |
+
<button class="phone-button" id="approveButton">Approve & open camera</button>
|
| 180 |
+
<button class="secondary" id="declineButton">Not now</button>
|
| 181 |
+
</div>
|
| 182 |
+
</div>
|
| 183 |
+
|
| 184 |
+
<div class="camera" id="camera">
|
| 185 |
+
<div class="camera-top"><button id="closeCamera" aria-label="Close camera">×</button><span>Answer scan</span><span>⚡</span></div>
|
| 186 |
+
<div class="viewfinder"><div class="corners"></div><div class="paper">∠A + ∠B + ∠C = 180°<br><svg viewBox="0 0 180 100"><path d="M18 80 L91 14 L163 80 Z" fill="none" stroke="#34312d" stroke-width="2"/><text x="70" y="95" font-size="12">x = 65°</text></svg>180 − 48 − 67 = 65°</div></div>
|
| 187 |
+
<div class="camera-controls"><span class="camera-tip">Fit the whole answer in frame</span><button class="shutter" id="shutter" aria-label="Take photo"></button><span class="camera-tip">Auto</span></div>
|
| 188 |
+
</div>
|
| 189 |
+
|
| 190 |
+
<div class="review" id="review">
|
| 191 |
+
<h2>Review your answer</h2>
|
| 192 |
+
<div class="photo">∠A + ∠B + ∠C = 180°<svg viewBox="0 0 180 110"><path d="M15 90 L91 15 L165 90 Z" fill="none" stroke="#34312d" stroke-width="2"/><text x="65" y="106" font-size="13">x = 65°</text></svg>180 − 48 − 67 = 65°</div>
|
| 193 |
+
<p>Make sure your full solution is clear and readable.</p>
|
| 194 |
+
<div class="review-actions"><button id="retake">Retake</button><button class="send" id="send">Use this photo</button></div>
|
| 195 |
+
</div>
|
| 196 |
+
<div class="toast" id="toast">✓ Answer sent to your computer</div>
|
| 197 |
+
</div>
|
| 198 |
+
</div>
|
| 199 |
+
<p class="helper" id="helper">Click the scan button on the computer to begin the prototype.</p>
|
| 200 |
+
</aside>
|
| 201 |
+
</div>
|
| 202 |
+
</main>
|
| 203 |
+
|
| 204 |
+
<script>
|
| 205 |
+
const scanButton = document.querySelector('#scanButton');
|
| 206 |
+
const approveButton = document.querySelector('#approveButton');
|
| 207 |
+
const declineButton = document.querySelector('#declineButton');
|
| 208 |
+
const requestCard = document.querySelector('#requestCard');
|
| 209 |
+
const phoneActions = document.querySelector('#phoneActions');
|
| 210 |
+
const phoneTitle = document.querySelector('#phoneTitle');
|
| 211 |
+
const phoneCopy = document.querySelector('#phoneCopy');
|
| 212 |
+
const desktopStatus = document.querySelector('#desktopStatus');
|
| 213 |
+
const camera = document.querySelector('#camera');
|
| 214 |
+
const review = document.querySelector('#review');
|
| 215 |
+
const answerArea = document.querySelector('#answerArea');
|
| 216 |
+
const helper = document.querySelector('#helper');
|
| 217 |
+
const toast = document.querySelector('#toast');
|
| 218 |
+
|
| 219 |
+
function status(text, className = '') {
|
| 220 |
+
desktopStatus.className = `status ${className}`;
|
| 221 |
+
desktopStatus.querySelector('span').textContent = text;
|
| 222 |
+
}
|
| 223 |
+
function openRequest() {
|
| 224 |
+
requestCard.hidden = false;
|
| 225 |
+
phoneActions.hidden = false;
|
| 226 |
+
phoneTitle.textContent = 'Scan your answer?';
|
| 227 |
+
phoneCopy.textContent = 'Your computer is waiting for a photo of your handwritten solution.';
|
| 228 |
+
scanButton.textContent = 'Waiting for phone…';
|
| 229 |
+
scanButton.disabled = true;
|
| 230 |
+
status('Waiting for your phone', 'waiting');
|
| 231 |
+
helper.textContent = 'The request is securely matched to the same signed-in student.';
|
| 232 |
+
}
|
| 233 |
+
function cancelRequest() {
|
| 234 |
+
requestCard.hidden = true;
|
| 235 |
+
phoneActions.hidden = true;
|
| 236 |
+
phoneTitle.textContent = 'Request dismissed';
|
| 237 |
+
phoneCopy.textContent = 'You can send another scan request from your computer.';
|
| 238 |
+
scanButton.textContent = 'Scan my answer with my phone';
|
| 239 |
+
scanButton.disabled = false;
|
| 240 |
+
status('Scan cancelled');
|
| 241 |
+
helper.textContent = 'Click the scan button to try again.';
|
| 242 |
+
}
|
| 243 |
+
function showCamera() { camera.classList.add('show'); helper.textContent = 'Camera access approved. Take a clear photo of the full solution.'; }
|
| 244 |
+
function resetMock() {
|
| 245 |
+
answerArea.classList.remove('received');
|
| 246 |
+
toast.classList.remove('show');
|
| 247 |
+
review.classList.remove('show');
|
| 248 |
+
camera.classList.remove('show');
|
| 249 |
+
requestCard.hidden = true;
|
| 250 |
+
phoneActions.hidden = true;
|
| 251 |
+
phoneTitle.textContent = 'Ready when you are';
|
| 252 |
+
phoneCopy.textContent = 'Start a scan request on your computer. It will appear here automatically.';
|
| 253 |
+
scanButton.textContent = 'Scan my answer with my phone';
|
| 254 |
+
scanButton.disabled = false;
|
| 255 |
+
status('Not started');
|
| 256 |
+
helper.textContent = 'Click the scan button on the computer to begin the prototype.';
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
scanButton.addEventListener('click', () => scanButton.dataset.done ? (delete scanButton.dataset.done, resetMock()) : openRequest());
|
| 260 |
+
approveButton.addEventListener('click', showCamera);
|
| 261 |
+
declineButton.addEventListener('click', cancelRequest);
|
| 262 |
+
document.querySelector('#closeCamera').addEventListener('click', () => camera.classList.remove('show'));
|
| 263 |
+
document.querySelector('#shutter').addEventListener('click', () => review.classList.add('show'));
|
| 264 |
+
document.querySelector('#retake').addEventListener('click', () => review.classList.remove('show'));
|
| 265 |
+
document.querySelector('#send').addEventListener('click', () => {
|
| 266 |
+
review.classList.remove('show');
|
| 267 |
+
camera.classList.remove('show');
|
| 268 |
+
answerArea.classList.add('received');
|
| 269 |
+
toast.classList.add('show');
|
| 270 |
+
phoneTitle.textContent = 'Answer sent';
|
| 271 |
+
phoneCopy.textContent = 'Your scanned work is now attached to the open question.';
|
| 272 |
+
requestCard.hidden = true;
|
| 273 |
+
phoneActions.hidden = true;
|
| 274 |
+
scanButton.disabled = false;
|
| 275 |
+
scanButton.textContent = 'Reset prototype';
|
| 276 |
+
scanButton.dataset.done = 'true';
|
| 277 |
+
status('Answer received', 'done');
|
| 278 |
+
helper.textContent = 'Success — the computer and phone are now in sync.';
|
| 279 |
+
setTimeout(() => toast.classList.remove('show'), 2800);
|
| 280 |
+
});
|
| 281 |
+
</script>
|
| 282 |
+
</body>
|
| 283 |
+
</html>
|