apple2js/js/ui/drive_lights.ts
Will Scullin 2daef8040f
Keep track of disk sides (#87)
Disk side information was being dropped and thus not displayable in the UI. This plumbs the value through various formats and adds some light testing.

Also fixes an issue where URL encoded hashes were not properly interpreted.
2021-10-02 11:45:09 -07:00

26 lines
895 B
TypeScript

import { Callbacks } from '../cards/disk2';
import type { DriveNumber } from '../formats/types';
export default class DriveLights implements Callbacks {
public driveLight(drive: DriveNumber, on: boolean) {
const disk =
document.querySelector('#disk' + drive)! as HTMLElement;
disk.style.backgroundImage =
on ? 'url(css/red-on-16.png)' :
'url(css/red-off-16.png)';
}
public dirty(_drive: DriveNumber, _dirty: boolean) {
// document.querySelector('#disksave' + drive).disabled = !dirty;
}
public label(drive: DriveNumber, label?: string, side?: string) {
const labelElement =
document.querySelector('#disk-label' + drive)! as HTMLElement;
if (label) {
labelElement.innerText = label + (side ? ` - ${side}` : '');
}
return labelElement.innerText;
}
}