Skip to content

Commit

Permalink
feat: articles check + translucency/animation toggles
Browse files Browse the repository at this point in the history
  • Loading branch information
NGPixel committed Mar 5, 2024
1 parent 18cd707 commit ed198d6
Show file tree
Hide file tree
Showing 17 changed files with 274 additions and 22 deletions.
3 changes: 2 additions & 1 deletion src-electron/electron-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ function createWindow () {
// useContentSize: true,
center: true,
frame: true,
backgroundColor: '#000',
// backgroundMaterial: 'auto',
vibrancy: 'under-window',
// vibrancy: 'under-window',
darkTheme: true,
webPreferences: {
contextIsolation: true,
Expand Down
24 changes: 21 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<router-view />
<template lang='pug'>
router-view
</template>

<script setup>
import { defineAsyncComponent, onMounted } from 'vue'
import { defineAsyncComponent, onMounted, watch } from 'vue'
import { useQuasar } from 'quasar'
import { useDocsStore } from 'src/stores/docs'
import { useEditorStore } from 'src/stores/editor'
Expand Down Expand Up @@ -77,6 +77,24 @@ window.ipcBridge.subscribe('setProgressDialog', (evt, opts) => {
}
})
// -> Handle translucency flags
watch(() => editorStore.translucencyEffects, (newValue) => {
if (newValue) {
document.body.classList.remove('no-translucency')
} else {
document.body.classList.add('no-translucency')
}
}, { immediate: true })
// -> Handle animation flags
watch(() => editorStore.animationEffects, (newValue) => {
if (newValue) {
document.body.classList.remove('no-animations')
} else {
document.body.classList.add('no-animations')
}
}, { immediate: true })
onMounted(async () => {
await editorStore.fetchGitConfig()
window.ipcBridge.emit('lspInitialize')
Expand Down
10 changes: 9 additions & 1 deletion src/components/AboutDialog.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<template lang="pug">
q-dialog(ref='dialogRef' @hide='onDialogHide' transition-show='jump-up' transition-hide='jump-down')
q-dialog(
ref='dialogRef'
@hide='onDialogHide'
:transition-show='editorStore.animationEffects ? `jump-up` : `none`'
:transition-hide='editorStore.animationEffects ? `jump-down` : `none`'
)
q-card(style='min-width: 600px;')
q-card-section.flex.items-center.bg-light-blue-10
q-icon(name='mdi-information-outline', left, size='sm')
Expand Down Expand Up @@ -28,6 +33,9 @@ q-dialog(ref='dialogRef' @hide='onDialogHide' transition-show='jump-up' transiti

<script setup>
import { useDialogPluginComponent, useQuasar } from 'quasar'
import { useEditorStore } from 'src/stores/editor'
const editorStore = useEditorStore()
const $q = useQuasar()
Expand Down
7 changes: 6 additions & 1 deletion src/components/CloneRepositoryDialog.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<template lang="pug">
q-dialog(ref='dialogRef' @hide='onDialogHide' persistent transition-show='jump-up' transition-hide='jump-down')
q-dialog(
ref='dialogRef'
@hide='onDialogHide'
:transition-show='editorStore.animationEffects ? `jump-up` : `none`'
:transition-hide='editorStore.animationEffects ? `jump-down` : `none`'
)
q-card.mica(style='min-width: 800px;')
q-card-section.flex.items-center.bg-light-blue-10
q-icon(name='mdi-git', left, size='sm')
Expand Down
64 changes: 58 additions & 6 deletions src/components/DrawerTools.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ q-list
q-item-section(side)
q-icon(v-if='editorStore.validationChecks[chk.key] === 0' name='mdi-circle-outline' size='xs' color='blue-grey')
q-icon(v-else-if='editorStore.validationChecks[chk.key] === 1' name='mdi-check-circle' size='xs' color='positive')
q-icon(v-else-if='editorStore.validationChecks[chk.key] === 2' name='mdi-information' size='xs' color='light-blue-5')
q-icon(v-else-if='editorStore.validationChecks[chk.key] === -1' name='mdi-close-circle' size='xs' color='red-5')
q-icon(v-else-if='editorStore.validationChecks[chk.key] === -2' name='mdi-alert-circle' size='xs' color='orange-5')
q-separator.q-my-sm(inset)
.q-px-md.q-pt-sm.q-pb-sm
.flex.items-center
Expand All @@ -45,6 +47,7 @@ q-list

<script setup>
import { useQuasar } from 'quasar'
import { checkArticles } from 'src/tools/articles'
import { checkInclusiveLanguage } from 'src/tools/inclusive-language'
import { checkNonAscii } from 'src/tools/non-ascii'
import { useDocsStore } from 'src/stores/docs'
Expand All @@ -59,6 +62,13 @@ const docsStore = useDocsStore()
const editorStore = useEditorStore()
const valChecks = [
{
key: 'articles',
title: 'Articles Check',
description: 'Check for bad indefinite articles usage',
icon: 'mdi-alpha-a-box-outline',
click: () => articlesCheck()
},
{
key: 'inclusiveLanguage',
title: 'Inclusive Language Check',
Expand All @@ -77,9 +87,37 @@ const valChecks = [
// METHODS
function articlesCheck (silent) {
const warnings = checkArticles(modelStore[docsStore.activeDocument.id].getValue())
if (warnings.length < 1) {
editorStore.setValidationCheckState('articles', 1)
if (!silent) {
$q.notify({
message: 'Looks good!',
caption: 'No bad usage of indefinite articles found.',
color: 'positive',
icon: 'mdi-alpha-a-box-outline'
})
}
} else {
editorStore.setValidationCheckState('articles', -2)
if (!silent) {
setTimeout(() => {
EVENT_BUS.emit('editorCommand', 'editor.action.marker.next')
})
}
}
if (silent) {
editorStore.errors.push(...warnings)
} else {
editorStore.errors = warnings
}
}
function inclusiveLangCheck (silent = false) {
editorStore.errors = checkInclusiveLanguage(modelStore[docsStore.activeDocument.id].getValue())
if (editorStore.errors.length < 1) {
const warnings = checkInclusiveLanguage(modelStore[docsStore.activeDocument.id].getValue())
if (warnings.length < 1) {
editorStore.setValidationCheckState('inclusiveLanguage', 1)
if (!silent) {
$q.notify({
Expand All @@ -90,18 +128,24 @@ function inclusiveLangCheck (silent = false) {
})
}
} else {
editorStore.setValidationCheckState('inclusiveLanguage', -1)
editorStore.setValidationCheckState('inclusiveLanguage', -2)
if (!silent) {
setTimeout(() => {
EVENT_BUS.emit('editorCommand', 'editor.action.marker.next')
})
}
}
if (silent) {
editorStore.errors.push(...warnings)
} else {
editorStore.errors = warnings
}
}
function nonAsciiCheck (silent = false) {
editorStore.errors = checkNonAscii(modelStore[docsStore.activeDocument.id].getValue())
if (editorStore.errors.length < 1) {
const infos = checkNonAscii(modelStore[docsStore.activeDocument.id].getValue())
if (infos.length < 1) {
editorStore.setValidationCheckState('nonAscii', 1)
if (!silent) {
$q.notify({
Expand All @@ -112,16 +156,24 @@ function nonAsciiCheck (silent = false) {
})
}
} else {
editorStore.setValidationCheckState('nonAscii', -1)
editorStore.setValidationCheckState('nonAscii', 2)
if (!silent) {
setTimeout(() => {
EVENT_BUS.emit('editorCommand', 'editor.action.marker.next')
})
}
}
if (silent) {
editorStore.errors.push(...infos)
} else {
editorStore.errors = infos
}
}
function runAllChecks () {
editorStore.clearErrors()
articlesCheck(true)
inclusiveLangCheck(true)
nonAsciiCheck(true)
Expand Down
7 changes: 6 additions & 1 deletion src/components/ManageBranchesDialog.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<template lang="pug">
q-dialog(ref='dialogRef' @hide='onDialogHide' transition-show='jump-up' transition-hide='jump-down')
q-dialog(
ref='dialogRef'
@hide='onDialogHide'
:transition-show='editorStore.animationEffects ? `jump-up` : `none`'
:transition-hide='editorStore.animationEffects ? `jump-down` : `none`'
)
q-card.mica.branches
q-card-section.flex.items-center.bg-light-blue-10
q-icon(name='mdi-source-branch', left, size='sm')
Expand Down
7 changes: 6 additions & 1 deletion src/components/ManageRemotesDialog.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<template lang="pug">
q-dialog(ref='dialogRef' @hide='onDialogHide' transition-show='jump-up' transition-hide='jump-down')
q-dialog(
ref='dialogRef'
@hide='onDialogHide'
:transition-show='editorStore.animationEffects ? `jump-up` : `none`'
:transition-hide='editorStore.animationEffects ? `jump-down` : `none`'
)
q-card.mica.remotes
q-card-section.flex.items-center.bg-light-blue-10
q-icon(name='mdi-satellite-uplink', left, size='sm')
Expand Down
13 changes: 10 additions & 3 deletions src/components/NewDraftDialog.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<template lang="pug">
q-dialog(ref='dialogRef' @hide='onDialogHide' transition-show='jump-up' transition-hide='jump-down')
q-dialog(
ref='dialogRef'
@hide='onDialogHide'
:transition-show='editorStore.animationEffects ? `jump-up` : `none`'
:transition-hide='editorStore.animationEffects ? `jump-down` : `none`'
)
q-card.mica(style='min-width: 600px;')
q-card-section.flex.items-center.bg-light-blue-10
q-icon(name='mdi-file-document-plus-outline', left, size='sm')
Expand All @@ -25,8 +30,8 @@ q-dialog(ref='dialogRef' @hide='onDialogHide' transition-show='jump-up' transiti
q-item-label(caption): em.text-grey Recommended
q-menu(
touch-position
transition-show='jump-down'
transition-hide='jump-up'
:transition-show='editorStore.animationEffects ? `jump-up` : `none`'
:transition-hide='editorStore.animationEffects ? `jump-down` : `none`'
)
q-list(separator bordered)
q-item(clickable @click='selectType(`xml`)')
Expand Down Expand Up @@ -75,8 +80,10 @@ q-dialog(ref='dialogRef' @hide='onDialogHide' transition-show='jump-up' transiti
<script setup>
import { useDialogPluginComponent, useQuasar } from 'quasar'
import { useDocsStore } from 'src/stores/docs'
import { useEditorStore } from 'src/stores/editor'
const docsStore = useDocsStore()
const editorStore = useEditorStore()
const $q = useQuasar()
Expand Down
9 changes: 8 additions & 1 deletion src/components/OpenFromUrlDialog.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<template lang="pug">
q-dialog(ref='dialogRef' @hide='onDialogHide' no-backdrop-dismiss transition-show='jump-up' transition-hide='jump-down')
q-dialog(
ref='dialogRef'
@hide='onDialogHide'
:transition-show='editorStore.animationEffects ? `jump-up` : `none`'
:transition-hide='editorStore.animationEffects ? `jump-down` : `none`'
)
q-card.mica(style='min-width: 800px;')
q-card-section.flex.items-center.bg-light-blue-10
q-icon(name='mdi-tray-arrow-down', left, size='sm')
Expand Down Expand Up @@ -42,6 +47,7 @@ q-dialog(ref='dialogRef' @hide='onDialogHide' no-backdrop-dismiss transition-sho
import { useDialogPluginComponent, useQuasar } from 'quasar'
import { reactive } from 'vue'
import { useDocsStore } from 'src/stores/docs'
import { useEditorStore } from 'src/stores/editor'
import { last } from 'lodash-es'
const $q = useQuasar()
Expand All @@ -55,6 +61,7 @@ defineEmits([
// STORES
const docsStore = useDocsStore()
const editorStore = useEditorStore()
// QUASAR
Expand Down
8 changes: 7 additions & 1 deletion src/components/OpenPGPSetupDialog.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<template lang="pug">
q-dialog(ref='dialogRef' @hide='onDialogHide' no-backdrop-dismiss)
q-dialog(
ref='dialogRef'
@hide='onDialogHide'
:transition-show='editorStore.animationEffects ? `jump-up` : `none`'
:transition-hide='editorStore.animationEffects ? `jump-down` : `none`'
no-backdrop-dismiss
)
q-card.mica(style='min-width: 800px;')
q-card-section.flex.items-center.bg-light-blue-10
q-icon(name='mdi-key-variant', left, size='sm')
Expand Down
28 changes: 27 additions & 1 deletion src/components/PreferencesDialog.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<template lang="pug">
q-dialog(ref='dialogRef', @hide='onDialogHide', transition-show='jump-up', transition-hide='jump-down')
q-dialog(
ref='dialogRef'
@hide='onDialogHide'
:transition-show='editorStore.animationEffects ? `jump-up` : `none`'
:transition-hide='editorStore.animationEffects ? `jump-down` : `none`'
)
q-card.mica.prefs
q-card-section.flex.items-center.bg-light-blue-10
q-icon(name='mdi-cog', left, size='sm')
Expand Down Expand Up @@ -60,6 +65,27 @@ q-dialog(ref='dialogRef', @hide='onDialogHide', transition-show='jump-up', trans
checked-icon='mdi-check'
unchecked-icon='mdi-close'
)
q-separator
.row
.col
.text-body2 Enable Translucency Effects
.text-caption.text-grey-5 Show translucent background effects on modals and menu UI elements.
.col-auto
q-toggle(
v-model='editorStore.translucencyEffects'
checked-icon='mdi-check'
unchecked-icon='mdi-close'
)
.row
.col
.text-body2 Enable Animations
.text-caption.text-grey-5 Use transition animations for modals and dialogs.
.col-auto
q-toggle(
v-model='editorStore.animationEffects'
checked-icon='mdi-check'
unchecked-icon='mdi-close'
)
template(v-else-if='state.tab === `editor`')
q-form.q-gutter-md.q-pa-lg
.row
Expand Down
Loading

0 comments on commit ed198d6

Please sign in to comment.