mirror of
https://github.com/bfloydd/streams.git
synced 2026-07-22 05:49:02 +00:00
remove bar style
This commit is contained in:
parent
24c52fa626
commit
d7ce138f91
11 changed files with 6 additions and 78 deletions
6
main.ts
6
main.ts
|
|
@ -45,12 +45,6 @@ export default class StreamsPlugin extends Plugin implements StreamsAPI {
|
|||
await this.saveSettings();
|
||||
}
|
||||
|
||||
// Migration: ensure barStyle exists
|
||||
if (!this.settings.barStyle) {
|
||||
this.settings.barStyle = 'default';
|
||||
await this.saveSettings();
|
||||
}
|
||||
|
||||
// Migration: ensure encryptThisStream, disabled, and merge 'folder' into 'dateFormat' for existing streams
|
||||
let needsSave = false;
|
||||
for (const stream of this.settings.streams) {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ export interface DefaultSettingsConfiguration {
|
|||
readonly reuseCurrentTab: boolean;
|
||||
|
||||
readonly debugLoggingEnabled: boolean;
|
||||
readonly barStyle: 'default';
|
||||
}
|
||||
|
||||
// Main configuration interface
|
||||
|
|
@ -109,8 +108,7 @@ export class ConfigurationService extends BaseSliceService implements Configurat
|
|||
showStreamsBarComponent: true,
|
||||
reuseCurrentTab: false,
|
||||
|
||||
debugLoggingEnabled: false,
|
||||
barStyle: 'default'
|
||||
debugLoggingEnabled: false
|
||||
} as const
|
||||
};
|
||||
|
||||
|
|
@ -226,8 +224,7 @@ export class ConfigurationService extends BaseSliceService implements Configurat
|
|||
showStreamsBarComponent: this.config.defaults.showStreamsBarComponent,
|
||||
reuseCurrentTab: this.config.defaults.reuseCurrentTab,
|
||||
|
||||
debugLoggingEnabled: this.config.defaults.debugLoggingEnabled,
|
||||
barStyle: this.config.defaults.barStyle
|
||||
debugLoggingEnabled: this.config.defaults.debugLoggingEnabled
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@ export const DEFAULT_SETTINGS = {
|
|||
primaryStreamId: null,
|
||||
showStreamsBarComponent: true,
|
||||
reuseCurrentTab: false,
|
||||
debugLoggingEnabled: false,
|
||||
barStyle: 'default' as const
|
||||
debugLoggingEnabled: false
|
||||
} as const;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ export interface StreamsSettings {
|
|||
reuseCurrentTab: boolean;
|
||||
|
||||
debugLoggingEnabled: boolean; // Whether debug logging is enabled by default
|
||||
barStyle: 'default' | 'modern'; // Style variant for the streams bar
|
||||
}
|
||||
|
||||
// Specific error data types for better type safety
|
||||
|
|
|
|||
|
|
@ -92,11 +92,6 @@ export class ComponentLifecycleManager {
|
|||
component.updateReuseCurrentTab(settings.reuseCurrentTab);
|
||||
}
|
||||
|
||||
// Refresh bar style for all existing components
|
||||
if (component && typeof component.refreshBarStyle === 'function') {
|
||||
component.refreshBarStyle();
|
||||
}
|
||||
|
||||
// Update streams list for all existing components
|
||||
if (component && typeof component.updateStreamsList === 'function' && settings.streams) {
|
||||
component.updateStreamsList(settings.streams);
|
||||
|
|
|
|||
|
|
@ -2,32 +2,20 @@ import { Stream } from '../../shared/types';
|
|||
import { setIcon } from 'obsidian';
|
||||
import { DateNavigationService } from './DateNavigationService';
|
||||
|
||||
/**
|
||||
* Interface for plugin that provides settings
|
||||
*/
|
||||
interface PluginInterface {
|
||||
settings: {
|
||||
barStyle?: 'default' | 'modern';
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages component state for StreamsBarComponent
|
||||
* Extracted to follow Single Responsibility Principle
|
||||
*/
|
||||
export class ComponentStateManager {
|
||||
private plugin: PluginInterface | null;
|
||||
private streams: Stream[];
|
||||
private selectedStream: Stream;
|
||||
private dateNavigationService: DateNavigationService;
|
||||
|
||||
constructor(
|
||||
plugin: PluginInterface | null,
|
||||
streams: Stream[],
|
||||
selectedStream: Stream,
|
||||
dateNavigationService: DateNavigationService
|
||||
) {
|
||||
this.plugin = plugin;
|
||||
this.streams = streams;
|
||||
this.selectedStream = selectedStream;
|
||||
this.dateNavigationService = dateNavigationService;
|
||||
|
|
@ -75,24 +63,6 @@ export class ComponentStateManager {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply bar style to a component based on settings
|
||||
*/
|
||||
applyBarStyle(component: HTMLElement): void {
|
||||
if (!this.plugin?.settings) {
|
||||
return;
|
||||
}
|
||||
|
||||
const barStyle = this.plugin.settings.barStyle;
|
||||
|
||||
// Remove existing style classes
|
||||
component.removeClass('modern-style');
|
||||
|
||||
// Apply the appropriate style class
|
||||
if (barStyle === 'modern') {
|
||||
component.addClass('modern-style');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the today button text based on the current date
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import { getStreamBaseFolder } from '../file-operations/streamUtils';
|
|||
|
||||
interface PluginInterface {
|
||||
settings: {
|
||||
barStyle?: 'default' | 'modern';
|
||||
};
|
||||
saveSettings(): void;
|
||||
setActiveStream(streamId: string, force?: boolean, suppressEvent?: boolean): Promise<void>;
|
||||
|
|
@ -100,12 +99,11 @@ export class StreamsBarComponent extends Component {
|
|||
this.eventRegistry = new EventHandlerRegistry();
|
||||
this.viewContainerService = new ViewContainerService();
|
||||
this.eventSubscriptionManager = new ComponentEventSubscriptionManager(this.dateStateManager);
|
||||
this.stateManager = new ComponentStateManager(plugin, streams, stream, this.dateNavigationService);
|
||||
this.stateManager = new ComponentStateManager(streams, stream, this.dateNavigationService);
|
||||
this.currentMonthView = new Date();
|
||||
|
||||
this.component = document.createElement('div');
|
||||
this.component.addClass('streams-bar-component');
|
||||
this.stateManager.applyBarStyle(this.component);
|
||||
this.initializeDateState(leaf);
|
||||
|
||||
this.eventSubscriptionManager.subscribeToDateChanges((state) => {
|
||||
|
|
@ -541,8 +539,6 @@ export class StreamsBarComponent extends Component {
|
|||
}
|
||||
|
||||
private handleSettingsChange(settings: StreamsSettings): void {
|
||||
this.stateManager.applyBarStyle(this.component);
|
||||
|
||||
if (settings.streams) {
|
||||
// Update streams list in selector
|
||||
this.updateStreamsList(settings.streams);
|
||||
|
|
@ -560,8 +556,5 @@ export class StreamsBarComponent extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
public refreshBarStyle(): void {
|
||||
this.stateManager.applyBarStyle(this.component);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,8 +151,7 @@ describe('ServiceCoordinator', () => {
|
|||
primaryStreamId: null,
|
||||
showStreamsBarComponent: true,
|
||||
reuseCurrentTab: false,
|
||||
debugLoggingEnabled: false,
|
||||
barStyle: 'default'
|
||||
debugLoggingEnabled: false
|
||||
};
|
||||
|
||||
serviceCoordinator.onSettingsChanged(newSettings);
|
||||
|
|
|
|||
|
|
@ -54,8 +54,7 @@ describe('Calendar Navigation Integration Tests', () => {
|
|||
|
||||
showStreamsBarComponent: true,
|
||||
reuseCurrentTab: false,
|
||||
debugLoggingEnabled: false,
|
||||
barStyle: 'default' as const
|
||||
debugLoggingEnabled: false
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ describe('RibbonService', () => {
|
|||
mockSettings = {
|
||||
streams: [],
|
||||
primaryStreamId: null,
|
||||
barStyle: 'default',
|
||||
reuseCurrentTab: false,
|
||||
// ... other settings as needed ...
|
||||
} as any;
|
||||
|
|
|
|||
|
|
@ -121,22 +121,6 @@ export class StreamsSettingTab extends PluginSettingTab {
|
|||
new Notice(`Debug logging ${value ? 'enabled' : 'disabled'}`);
|
||||
}));
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName('Bar style')
|
||||
.setDesc('Choose the visual style for the streams bar component')
|
||||
.addDropdown(dropdown => dropdown
|
||||
.addOption('default', 'Default')
|
||||
.addOption('modern', 'Modern')
|
||||
.setValue(this.settingsManager.settings.barStyle)
|
||||
.onChange(async (value: 'default' | 'modern') => {
|
||||
this.settingsManager.settings.barStyle = value;
|
||||
await this.settingsManager.saveSettings();
|
||||
|
||||
eventBus.emit(EVENTS.SETTINGS_CHANGED, this.settingsManager.settings, 'settings-management');
|
||||
|
||||
new Notice(`Bar style changed to ${value === 'default' ? 'Default' : 'Modern'}`);
|
||||
}));
|
||||
|
||||
new Setting(containerEl).setName('Streams').setHeading();
|
||||
|
||||
new Setting(containerEl)
|
||||
|
|
|
|||
Loading…
Reference in a new issue