Skip to content

Commit

Permalink
refacto: Clean code (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
skarab42 authored Mar 30, 2021
1 parent 357984f commit 84d542b
Show file tree
Hide file tree
Showing 17 changed files with 21 additions and 27 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
front-src/libs/ejs.js
app/client/css/
app/client/js/
node_modules/
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ node_modules/
dist/
*_.*
*_
front-src/libs/ejs.js
8 changes: 2 additions & 6 deletions app/main/window/hideOnClose.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
const { app } = require("electron");
const quit = require("../quit");



module.exports = function hideOnClose(win) {
let willQuitApp = false;

win.on("close", (event) => {

// Quit on Cmd + Q on Mac
if (willQuitApp && process.platform === 'darwin') {
if (willQuitApp && process.platform === "darwin") {
quit();
}

Expand All @@ -20,6 +17,5 @@ module.exports = function hideOnClose(win) {
});

// Detect If the user decide to quit app
app.on('before-quit', () => willQuitApp = true);

app.on("before-quit", () => (willQuitApp = true));
};
4 changes: 2 additions & 2 deletions app/server/libs/twitch/AuthProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ module.exports = class AuthProvider {
getAuthUrl(scopes) {
return encodeURI(
`${authBaseURL}&client_id=${this.clientId}` +
`&redirect_uri=${this.redirectURI}&scope=${scopes.join(" ")}` +
`&force_verify=${this.forceVerify ? "true" : "false"}`
`&redirect_uri=${this.redirectURI}&scope=${scopes.join(" ")}` +
`&force_verify=${this.forceVerify ? "true" : "false"}`
);
}

Expand Down
3 changes: 2 additions & 1 deletion app/static/locales/en/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@
"onCommand": "Command",
"onRedemption": "Redemption",
"onBits": "Bits",
"onShortcut": "Shortcut"
"onShortcut": "Shortcut",
"null": "twitch.events.null"
}
},
"labels": {
Expand Down
3 changes: 2 additions & 1 deletion app/static/locales/es/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@
"onCommand": "Comando",
"onRedemption": "Redemption",
"onBits": "Bits",
"onShortcut": "Shortcut"
"onShortcut": "Shortcut",
"null": "twitch.events.null"
}
},
"labels": {
Expand Down
3 changes: 2 additions & 1 deletion app/static/locales/fr/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@
"onCommand": "Command",
"onRedemption": "Redemption",
"onBits": "Bits",
"onShortcut": "Shortcut"
"onShortcut": "Shortcut",
"null": "twitch.events.null"
}
},
"labels": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
export let notify = null;
const dispatch = createEventDispatcher();
let value = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
let eventsNames = [];
function setEventName(name) {
$fakeEventName = name;
$fakeEvent = { eventName: `on${name}`, ...$events[$fakeEventName] };
fakeEventName.set(name);
fakeEvent.set({ eventName: `on${name}`, ...$events[$fakeEventName] });
}
function updateEvents() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
function selectItem(item) {
if (!$selectedItem || $selectedItem.id !== item.id) {
$selectedKeyframe = null;
$selectedItem = item;
selectedKeyframe.set(null);
selectedItem.set(item);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script>
import api from "@/api/twitch";
import { _ } from "@/libs/i18next";
import { getContext } from "svelte";
import Select from "./Select.svelte";
import EventSelect from "./EventSelect.svelte";
Expand All @@ -27,7 +26,7 @@
function updateTag() {
eventTags[eventTag] = eventTagValue;
api.setEvent({ name: `on${$fakeEventName}`, tags: eventTags });
$fakeEvent = { eventName: `on${$fakeEventName}`, ...eventTags };
fakeEvent.set({ eventName: `on${$fakeEventName}`, ...eventTags });
}
function onTagChange({ target }) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script>
import { _ } from "@/libs/i18next";
import { createEventDispatcher } from "svelte";
export let value;
Expand Down
3 changes: 1 addition & 2 deletions front-src/client/components/Panels/Panel/Grid.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script>
import Grid from "svelte-grid";
import { _ } from "@/libs/i18next";
import Widget from "./Widget.svelte";
import { update } from "@/libs/panels";
import { onMount, onDestroy } from "svelte";
Expand All @@ -13,7 +12,7 @@
}
function hide() {
$selectedWidget = null;
selectedWidget.set(null);
}
onMount(() => document.addEventListener("mousedown", hide));
Expand Down
6 changes: 3 additions & 3 deletions front-src/client/components/Panels/Panel/Widget.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
async function duplicate() {
const { widget } = await duplicateWidget({ panel, item });
$selectedWidget = widget;
selectedWidget.set(widget);
}
function moveTo() {
Expand All @@ -50,8 +50,8 @@
async function onPanelSelect({ detail: targetPanel }) {
await moveWidgetToPanel({ panel, targetPanel, item });
$currentPanel = targetPanel;
$selectedWidget = widget;
currentPanel.set(targetPanel);
selectedWidget.set(widget);
}
function editStyles() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script>
import { _ } from "@/libs/i18next";
import widgets from "@/components/Widgets";
import MdAdd from "svelte-icons/md/MdAdd.svelte";
import { editMode, selectedWidget } from "@/stores/panels";
export let widget;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { _ } from "@/libs/i18next";
import { update } from "@/libs/panels";
import isValidEvent from "./isValidEvent";
import { createEventDispatcher } from "svelte";
import Button from "@/components/UI/Button.svelte";
import MdCode from "svelte-icons/md/MdCode.svelte";
import MdClose from "svelte-icons/md/MdClose.svelte";
Expand Down
1 change: 0 additions & 1 deletion front-src/client/components/UI/CodeMirror.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script>
import { _ } from "@/libs/i18next";
import CodeMirror from "codemirror";
import { debounce } from "throttle-debounce";
import { createEventDispatcher } from "svelte";
Expand Down

0 comments on commit 84d542b

Please sign in to comment.