mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-22 09:37:17 +00:00
Standardize feature flags, such as they are
This commit is contained in:
parent
969cc4239b
commit
c3a3614c2c
4 changed files with 42 additions and 39 deletions
|
|
@ -6,6 +6,7 @@ import { getTimeStr } from "../../utils";
|
|||
|
||||
import { STEP_MARQUEE } from "../../actionTypes";
|
||||
import CharacterString from "../CharacterString";
|
||||
import { noMarquee } from "../../config";
|
||||
|
||||
const CHAR_WIDTH = 5;
|
||||
|
||||
|
|
@ -74,7 +75,9 @@ class Marquee extends React.Component {
|
|||
step();
|
||||
}, 220);
|
||||
};
|
||||
step();
|
||||
if (!noMarquee) {
|
||||
step();
|
||||
}
|
||||
}
|
||||
|
||||
getText() {
|
||||
|
|
|
|||
6
js/config.js
Normal file
6
js/config.js
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
const { hash } = window.location;
|
||||
// Turn on the incomplete playlist window
|
||||
export const playlistEnabled = hash.includes("playlist");
|
||||
// Turn on the incomplete equalizer window
|
||||
export const equalizerEnabled = hash.includes("equalizer");
|
||||
export const noMarquee = hash.includes("!marquee");
|
||||
10
js/index.js
10
js/index.js
|
|
@ -13,13 +13,9 @@ import EqualizerWindow from "./components/EqualizerWindow";
|
|||
import Winamp from "./winamp";
|
||||
import Hotkeys from "./hotkeys";
|
||||
import Skin from "./components/Skin";
|
||||
import { equalizerEnabled, playlistEnabled } from "./config";
|
||||
|
||||
if (new Browser(window).isCompatible) {
|
||||
const hash = window.location.hash;
|
||||
// Turn on the incomplete playlist window
|
||||
const playlist = hash.includes("playlist");
|
||||
// Turn on the incomplete equalizer window
|
||||
const equalizer = hash.includes("equalizer");
|
||||
const winamp = Winamp;
|
||||
|
||||
const store = getStore(winamp);
|
||||
|
|
@ -33,8 +29,8 @@ if (new Browser(window).isCompatible) {
|
|||
</Skin>
|
||||
<WindowManager>
|
||||
<MainWindow fileInput={winamp.fileInput} mediaPlayer={winamp.media} />
|
||||
{playlist && <PlaylistWindow />}
|
||||
{equalizer && <EqualizerWindow fileInput={winamp.fileInput} />}
|
||||
{playlistEnabled && <PlaylistWindow />}
|
||||
{equalizerEnabled && <EqualizerWindow fileInput={winamp.fileInput} />}
|
||||
</WindowManager>
|
||||
</div>
|
||||
</Provider>,
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import {
|
|||
UNSET_FOCUS,
|
||||
UPDATE_TIME_ELAPSED
|
||||
} from "./actionTypes";
|
||||
import { equalizerEnabled } from "./config";
|
||||
|
||||
export const userInput = (state, action) => {
|
||||
if (!state) {
|
||||
|
|
@ -54,18 +55,17 @@ export const userInput = (state, action) => {
|
|||
}
|
||||
};
|
||||
|
||||
const windows = (state, action) => {
|
||||
if (!state) {
|
||||
return {
|
||||
focused: WINDOWS.MAIN,
|
||||
equalizer: false
|
||||
};
|
||||
}
|
||||
const defaultWindowsState = {
|
||||
focused: WINDOWS.MAIN,
|
||||
equalizer: equalizerEnabled
|
||||
};
|
||||
|
||||
const windows = (state = defaultWindowsState, action) => {
|
||||
switch (action.type) {
|
||||
case SET_FOCUSED_WINDOW:
|
||||
return { ...state, focused: action.window };
|
||||
case TOGGLE_EQUALIZER_WINDOW:
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
if (!equalizerEnabled) {
|
||||
return state;
|
||||
}
|
||||
return { ...state, equalizer: !state.equalizer };
|
||||
|
|
@ -76,23 +76,22 @@ const windows = (state, action) => {
|
|||
}
|
||||
};
|
||||
|
||||
const display = (state, action) => {
|
||||
if (!state) {
|
||||
return {
|
||||
doubled: false,
|
||||
marqueeStep: 0,
|
||||
loading: true,
|
||||
llama: false,
|
||||
closed: false,
|
||||
shade: false,
|
||||
equalizerShade: false,
|
||||
working: false,
|
||||
skinImages: {},
|
||||
skinColors: null,
|
||||
skinPlaylistStyle: {},
|
||||
visualizerStyle: 2
|
||||
};
|
||||
}
|
||||
const defaultDisplayState = {
|
||||
doubled: false,
|
||||
marqueeStep: 0,
|
||||
loading: true,
|
||||
llama: false,
|
||||
closed: false,
|
||||
shade: false,
|
||||
equalizerShade: false,
|
||||
working: false,
|
||||
skinImages: {},
|
||||
skinColors: null,
|
||||
skinPlaylistStyle: {},
|
||||
visualizerStyle: 2
|
||||
};
|
||||
|
||||
const display = (state = defaultDisplayState, action) => {
|
||||
switch (action.type) {
|
||||
case TOGGLE_DOUBLESIZE_MODE:
|
||||
return { ...state, doubled: !state.doubled };
|
||||
|
|
@ -128,12 +127,11 @@ const display = (state, action) => {
|
|||
}
|
||||
};
|
||||
|
||||
const contextMenu = (state, action) => {
|
||||
if (!state) {
|
||||
return {
|
||||
selected: false
|
||||
};
|
||||
}
|
||||
const defaultContextMenuState = {
|
||||
selected: false
|
||||
};
|
||||
|
||||
const contextMenu = (state = defaultContextMenuState, action) => {
|
||||
switch (action.type) {
|
||||
case TOGGLE_CONTEXT_MENU:
|
||||
return { ...state, selected: !state.selected };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue