antares/src/renderer/components/TheFooter.vue

143 lines
4.5 KiB
Vue
Raw Normal View History

2020-05-08 18:02:18 +02:00
<template>
<div
id="footer"
:class="[lightColors.includes(footerColor) ? 'text-dark' : 'text-light']"
:style="`background-color: ${footerColor};`"
>
2020-05-08 18:02:18 +02:00
<div class="footer-left-elements">
<ul class="footer-elements">
<li class="footer-element">
<i class="mdi mdi-18px mdi-database mr-1" />
<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">
<i class="mdi mdi-18px mdi-lock mr-1" />
<small>{{ t('connection.readOnlyMode') }}</small>
2023-01-05 17:21:22 +01:00
</li>
<li v-if="connectionInfos && connectionInfos.ssl" class="footer-element">
<i class="mdi mdi-18px mdi-shield-key mr-1" />
<small>SSL</small>
</li>
<li v-if="connectionInfos && connectionInfos.ssh" class="footer-element">
<i class="mdi mdi-18px mdi-console-network mr-1" />
<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
>
<i class="mdi mdi-18px mdi-console-line mr-1" />
<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')">
<i class="mdi mdi-18px mdi-coffee mr-1" />
<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')"
>
<i class="mdi mdi-18px mdi-bug" />
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')"
>
<i class="mdi mdi-18px mdi-information-outline" />
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 } from 'vue';
2022-07-16 12:01:37 +02:00
import { useI18n } from 'vue-i18n';
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));
const footerColor = computed(() => getConnectionFolder(workspaceUid.value)?.color || '#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 '';
});
const openOutside = (link: string) => shell.openExternal(link);
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>