antares/src/renderer/components/TheFooter.vue

183 lines
5.6 KiB
Vue
Raw Normal View History

2020-05-08 18:02:18 +02:00
<template>
<div
id="footer"
2024-05-02 18:00:07 +02:00
:class="[lightColors.includes(accentColor) ? 'text-dark' : 'text-light']"
:style="`background-color: ${accentColor};`"
>
2020-05-08 18:02:18 +02:00
<div class="footer-left-elements">
<ul class="footer-elements">
<li class="footer-element">
<BaseIcon
icon-name="mdiServer"
class="mr-1"
:size="18"
/>
<small>{{ versionString }}</small>
2020-05-08 18:02:18 +02:00
</li>
2023-01-05 17:21:22 +01:00
<li v-if="connectionInfos && connectionInfos.readonly" class="footer-element">
<BaseIcon
icon-name="mdiLock"
class="mr-1"
:size="18"
/>
<small>{{ t('connection.readOnlyMode') }}</small>
2023-01-05 17:21:22 +01:00
</li>
<li v-if="connectionInfos && connectionInfos.ssl" class="footer-element">
<BaseIcon
icon-name="mdiShieldKey"
class="mr-1"
:size="18"
/>
2023-01-05 17:21:22 +01:00
<small>SSL</small>
</li>
<li v-if="connectionInfos && connectionInfos.ssh" class="footer-element">
<BaseIcon
icon-name="mdiConsoleNetwork"
class="mr-1"
:size="18"
/>
2023-01-05 17:21:22 +01:00
<small>SSH</small>
</li>
2020-05-08 18:02:18 +02:00
</ul>
</div>
<div class="footer-right-elements">
<ul class="footer-elements">
2022-07-16 12:01:37 +02:00
<li
v-if="workspace?.connectionStatus === 'connected'"
2022-07-16 12:01:37 +02:00
class="footer-element footer-link"
@click="toggleConsole()"
2022-07-16 12:01:37 +02:00
>
<BaseIcon
icon-name="mdiConsoleLine"
class="mr-1"
:size="18"
/>
<small>{{ t('application.console') }}</small>
2022-07-16 12:01:37 +02:00
</li>
2022-02-11 23:19:43 +01:00
<li class="footer-element footer-link" @click="openOutside('https://www.paypal.com/paypalme/fabiodistasio')">
<BaseIcon
icon-name="mdiCoffee"
class="mr-1"
:size="18"
/>
<small>{{ t('general.donate') }}</small>
2020-05-08 18:02:18 +02:00
</li>
2022-07-16 12:01:37 +02:00
<li
class="footer-element footer-link"
:title="t('application.reportABug')"
2022-07-16 12:01:37 +02:00
@click="openOutside('https://github.com/antares-sql/antares/issues')"
>
<BaseIcon icon-name="mdiBug" :size="18" />
2020-05-31 17:56:33 +02:00
</li>
2022-07-16 12:01:37 +02:00
<li
class="footer-element footer-link"
:title="t('application.about')"
2022-07-16 12:01:37 +02:00
@click="showSettingModal('about')"
>
<BaseIcon icon-name="mdiInformationOutline" :size="18" />
2020-05-08 18:02:18 +02:00
</li>
</ul>
</div>
</div>
</template>
<script setup lang="ts">
import { shell } from 'electron';
import { storeToRefs } from 'pinia';
import { computed, ComputedRef, watch } from 'vue';
2022-07-16 12:01:37 +02:00
import { useI18n } from 'vue-i18n';
import BaseIcon from '@/components/BaseIcon.vue';
import { hexToRGBA } from '@/libs/hexToRgba';
2022-04-27 18:23:48 +02:00
import { useApplicationStore } from '@/stores/application';
import { useConnectionsStore } from '@/stores/connections';
import { useConsoleStore } from '@/stores/console';
import { useWorkspacesStore } from '@/stores/workspaces';
2022-07-16 12:01:37 +02:00
const { t } = useI18n();
2020-05-08 18:02:18 +02:00
interface DatabaseInfos {// TODO: temp
name: string;
number: string;
arch: string;
os: string;
}
2022-04-30 00:47:37 +02:00
const applicationStore = useApplicationStore();
const workspacesStore = useWorkspacesStore();
const connectionsStore = useConnectionsStore();
const lightColors = ['#FFCE54', '#FDA50F', '#BEBDB8', '#48CFAD'];
2022-04-27 18:23:48 +02:00
const { getSelected: workspaceUid } = storeToRefs(workspacesStore);
2022-07-16 12:01:37 +02:00
const { toggleConsole } = useConsoleStore();
2022-04-27 18:23:48 +02:00
const { showSettingModal } = applicationStore;
const { getWorkspace } = workspacesStore;
2023-01-05 17:21:22 +01:00
const { getConnectionFolder, getConnectionByUid } = connectionsStore;
const workspace = computed(() => getWorkspace(workspaceUid.value));
2024-05-02 18:00:07 +02:00
const accentColor = computed(() => {
if (getConnectionFolder(workspaceUid.value)?.color)
return getConnectionFolder(workspaceUid.value).color;
return '#E36929';
});
2023-01-05 17:21:22 +01:00
const connectionInfos = computed(() => getConnectionByUid(workspaceUid.value));
const version: ComputedRef<DatabaseInfos> = computed(() => {
return getWorkspace(workspaceUid.value) ? workspace.value.version : null;
});
const versionString = computed(() => {
if (version.value)
return `${version.value.name} ${version.value.number} (${version.value.arch} ${version.value.os})`;
return '';
});
2024-05-02 18:00:07 +02:00
watch(accentColor, () => {
changeAccentColor();
});
const openOutside = (link: string) => shell.openExternal(link);
2024-05-02 18:00:07 +02:00
const changeAccentColor = () => {
document.querySelector<HTMLBodyElement>(':root').style.setProperty('--primary-color', accentColor.value);
document.querySelector<HTMLBodyElement>(':root').style.setProperty('--primary-color-shadow', hexToRGBA(accentColor.value, 0.2));
};
changeAccentColor();
2020-05-08 18:02:18 +02:00
</script>
<style lang="scss">
2020-07-31 18:16:28 +02:00
#footer {
height: $footer-height;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 0.2rem;
position: fixed;
bottom: 0;
left: 0;
right: 0;
.footer-elements {
list-style: none;
margin: 0;
2020-05-08 18:02:18 +02:00
display: flex;
align-items: center;
2020-07-31 18:16:28 +02:00
.footer-element {
height: $footer-height;
display: flex;
align-items: center;
padding: 0 0.4rem;
margin: 0;
2020-05-31 17:56:33 +02:00
2020-07-31 18:16:28 +02:00
&.footer-link {
cursor: pointer;
transition: background 0.2s;
}
2020-05-08 18:02:18 +02:00
}
2020-07-31 18:16:28 +02:00
}
}
2020-05-08 18:02:18 +02:00
</style>