change users sessions icons

This commit is contained in:
Tim Gröger 2023-05-03 12:45:03 +02:00
parent 9ff8e61c85
commit ca2a1ae387
1 changed files with 28 additions and 16 deletions

View File

@ -15,7 +15,11 @@
<div class="col">Plattform:</div>
<div class="col">
<q-icon :name="getPlatformIcon(modelValue.platform)" size="24px" />
<q-icon v-if="!modelValue.browser" :name="getOS(modelValue.platform)" size="24px" />
<q-icon
v-if="getOS(modelValue.platform)"
:name="getOS(modelValue.platform)"
size="24px"
/>
</div>
</div>
</div>
@ -78,38 +82,46 @@ export default defineComponent({
const options = ref(['Minuten', 'Stunden', 'Tage']);
const option = ref<string>(options.value[0]);
const lifetime = ref(0);
function getBrowserIcon(browser: string) {
console.log('browser', browser);
return browser == 'firefox'
function getBrowserIcon(br: string) {
const browser = br.toLowerCase();
return browser.includes('firefox')
? 'mdi-firefox'
: browser == 'chrome'
: browser.includes('chrome')
? 'mdi-google-chrome'
: browser == 'safari'
: browser.includes('safari')
? 'mdi-apple-safari'
: browser.includes('edge')
? 'mdi-microsoft-edge'
: browser.includes('opera')
? 'mdi-opera'
: browser.includes('ie')
? 'mdi-internet-explorer'
: 'mdi-help';
}
function getPlatformIcon(platform: string) {
function getPlatformIcon(pl: string) {
const platform = pl.toLowerCase();
console.log('platform', platform);
return platform == 'linux'
return platform.includes('linux')
? 'mdi-linux'
: platform == 'windows'
: platform.includes('windows')
? 'mdi-microsoft-windows'
: platform == 'macos'
: platform.includes('mac')
? 'mdi-apple'
: platform == 'iphone'
: platform.includes('ios')
? 'mdi-cellphone'
: platform == 'android'
: platform.includes('android')
? 'mdi-cellphone'
: 'mdi-help';
}
function getOS(platform: string) {
return platform == 'iphone'
function getOS(pl: string) {
const platform = pl.toLowerCase();
return platform.includes('ios')
? 'mdi-apple'
: platform == 'android'
: platform.includes('android')
? 'mdi-android'
: 'mdi-help';
: false;
}
async function deleteSession(token: string) {