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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/components/OnboardingTour.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export default function OnboardingTour() {
useEffect(() => {
if (localStorage.getItem(TOUR_KEY)) return;
const t = setTimeout(async () => {
const rect = await measureTarget(TOUR_STEPS[0].targetId);
const rect = await measureTarget(TOUR_STEPS[0]?.targetId ?? "");
if (rect) {
setTargetRect(rect);
setVisible(true);
Expand All @@ -267,7 +267,7 @@ useEffect(() => {
isFirstRender.current = false;
return;
}
measureTarget(TOUR_STEPS[stepIndex].targetId).then((rect) => {
measureTarget(TOUR_STEPS[stepIndex]?.targetId ?? "").then((rect) => {
if (rect) {
setTargetRect(rect);
setTimeout(() => tooltipRef.current?.focus(), 50);
Expand All @@ -285,7 +285,7 @@ useEffect(() => {
useEffect(() => {
if (!visible) return;
const onResize = () => {
measureTarget(TOUR_STEPS[stepIndex].targetId).then(setTargetRect);
measureTarget(TOUR_STEPS[stepIndex]?.targetId ?? "").then(setTargetRect);
};
window.addEventListener("resize", onResize);
return () => window.removeEventListener("resize", onResize);
Expand Down Expand Up @@ -318,7 +318,7 @@ useEffect(() => {
/>
<Spotlight rect={targetRect} />
<Tooltip
step={TOUR_STEPS[stepIndex]}
step={TOUR_STEPS[stepIndex]!}
stepIndex={stepIndex}
totalSteps={TOUR_STEPS.length}
rect={targetRect}
Expand Down
6 changes: 3 additions & 3 deletions src/components/ThumbnailStrip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default function ThumbnailStrip({
for (let t = 0; t <= duration; t += intervalSeconds) {
times.push(Math.min(t, duration - 0.1));
}
if (times[times.length - 1] < duration - 0.5) {
if ((times[times.length - 1] ?? 0) < duration - 0.5) {
times.push(duration - 0.1);
}

Expand All @@ -79,7 +79,7 @@ export default function ThumbnailStrip({
for (let i = 0; i < times.length; i++) {
if (abortRef.current) break;

const time = times[i];
const time = times[i] ?? 0;
await new Promise<void>((resolve) => {
const onSeeked = () => {
video.removeEventListener("seeked", onSeeked);
Expand Down Expand Up @@ -117,7 +117,7 @@ export default function ThumbnailStrip({
const activeIndex = thumbnails.findIndex(
(t, i) =>
currentTime >= t.time &&
(i === thumbnails.length - 1 || currentTime < thumbnails[i + 1].time)
(i === thumbnails.length - 1 || currentTime < (thumbnails[i + 1]?.time ?? Infinity))
);

if (!videoSrc) return null;
Expand Down
3 changes: 2 additions & 1 deletion src/components/TipCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ export default function TipCarousel() {
};

const activeTip = TIPS[activeIdx];
const IconComponent = activeTip.icon;
if (!activeTip) return null;
const IconComponent = activeTip.icon;

return (
<div
Expand Down
2 changes: 1 addition & 1 deletion src/components/VideoEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ export default function VideoEditor() {
{recommendedPreset && (
<div className="mb-4 rounded-2xl border border-film-200 bg-film-50 p-3 text-sm text-film-700">
<p>
We detected a {recommendedPreset.label.replace(/\s/g, "")} video → Recommended: {recommendedPreset.platform.split("·")[0].trim()} ({recommendedPreset.label.replace(/\s/g, "")})
We detected a {recommendedPreset.label.replace(/\s/g, "")} video → Recommended: {(recommendedPreset.platform.split("·")[0] ?? "").trim()} ({recommendedPreset.label.replace(/\s/g, "")})
</p>
</div>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/WaveformCanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default function WaveformCanvas({ samples, loading, hasAudio }: Props) {
ctx.globalAlpha = 0.7;

for (let i = 0; i < samples.length; i++) {
const amplitude = samples[i];
const amplitude = samples[i] ?? 0;
const barHeight = Math.max(amplitude * (height * 0.92), 1.5);
const x = i * barWidth;
const y = midY - barHeight / 2;
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noUncheckedIndexedAccess": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
Expand Down
Loading