Auto Scroll Update
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
onComplete?: () => void;
|
||||
interactive?: boolean;
|
||||
speed?: SpeedPreset | number;
|
||||
autoscroll?: boolean;
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -26,7 +27,8 @@
|
||||
class: className = '',
|
||||
onComplete,
|
||||
interactive = true,
|
||||
speed = 'normal'
|
||||
speed = 'normal',
|
||||
autoscroll = true
|
||||
}: Props = $props();
|
||||
|
||||
// Calculate speed multiplier from preset or number
|
||||
@@ -54,14 +56,13 @@
|
||||
let terminalElement: HTMLDivElement;
|
||||
let bodyElement = $state<HTMLDivElement>();
|
||||
|
||||
// Autoscroll to bottom
|
||||
// Autoscroll to bottom (respects autoscroll prop)
|
||||
function scrollToBottom() {
|
||||
if (bodyElement) {
|
||||
bodyElement.scrollTo({
|
||||
top: bodyElement.scrollHeight,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
}
|
||||
if (!autoscroll || !bodyElement) return;
|
||||
bodyElement.scrollTo({
|
||||
top: bodyElement.scrollHeight,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
}
|
||||
|
||||
// Get all interactive button indices
|
||||
|
||||
+17
-3
@@ -4,12 +4,13 @@
|
||||
// ============================================================================
|
||||
|
||||
export const user = {
|
||||
name: 'Sir Blob',
|
||||
name: 'Gagan M',
|
||||
displayname: 'Sir Blob',
|
||||
username: 'sirblob',
|
||||
hostname: 'engineering',
|
||||
title: 'Engineering Student',
|
||||
email: 'you@example.com',
|
||||
location: 'San Francisco, CA',
|
||||
email: 'sirblob0@gmail.com',
|
||||
location: 'Washington DC-Baltimore Area',
|
||||
bio: `Hi, I am Sir Blob — a engineer who loves making things.` +
|
||||
`I build fun coding projects, participate in game jams and hackathons, and enjoy games like Minecraft and Pokémon TCG Live.`,
|
||||
|
||||
@@ -487,6 +488,19 @@ export const pageSpeedSettings: Record<string, SpeedPreset | number> = {
|
||||
'hackathons': 'normal'
|
||||
};
|
||||
|
||||
// Per-page autoscroll settings (whether to auto-scroll as content types)
|
||||
// Set to false to disable autoscroll on specific pages
|
||||
export const pageAutoscrollSettings: Record<string, boolean> = {
|
||||
// Examples:
|
||||
// 'home': true, // Enable autoscroll
|
||||
// 'portfolio': false, // Disable autoscroll
|
||||
'home': true,
|
||||
'portfolio': false,
|
||||
'models': true,
|
||||
'hackathons': false,
|
||||
'components': true
|
||||
};
|
||||
|
||||
// Speed preset multipliers (lower = faster)
|
||||
export const speedPresets: Record<SpeedPreset, number> = {
|
||||
'instant': 0, // No delay, instant display
|
||||
|
||||
+12
-2
@@ -1,5 +1,5 @@
|
||||
// Central helper functions and re-exports
|
||||
import { terminalSettings, pageSpeedSettings, speedPresets, user } from './config';
|
||||
import { terminalSettings, pageSpeedSettings, speedPresets, pageAutoscrollSettings, user } from './config';
|
||||
|
||||
export type SpeedPreset = 'instant' | 'fast' | 'normal' | 'slow' | 'typewriter';
|
||||
|
||||
@@ -45,6 +45,16 @@ export function getPageSpeedMultiplier(pageName: string): number {
|
||||
return speedPresets[setting] ?? 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get autoscroll setting for a page
|
||||
* @param pageName - Name of the page (e.g., 'home', 'portfolio')
|
||||
* @returns boolean - Whether autoscroll is enabled (default: true)
|
||||
*/
|
||||
export function getPageAutoscroll(pageName: string): boolean {
|
||||
const setting = pageAutoscrollSettings[pageName];
|
||||
return setting ?? true; // Default to enabled
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the terminal prompt string
|
||||
*/
|
||||
@@ -64,4 +74,4 @@ export function getPrompt(path: string = '~'): string {
|
||||
}
|
||||
|
||||
// Barrel exports (convenience re-exports)
|
||||
export { user, terminalSettings, pageSpeedSettings, speedPresets, pageMeta, site } from './config';
|
||||
export { user, terminalSettings, pageSpeedSettings, speedPresets, pageAutoscrollSettings, pageMeta, site } from './config';
|
||||
|
||||
Reference in New Issue
Block a user