An online poker tracker for PokerTH (https://pokerth.net). Continuation of https://github.com/Pik-9/PokerTH-Tracker https://finda.fish
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

120 lines
2.6 KiB

<template>
<v-container>
<v-row justify="center">
<v-col justify="center" cols=10>
<v-alert type="error" v-show="errorOccured">
{{ $t('free-token-error') }}
</v-alert>
</v-col>
</v-row>
<v-row align="center" justify="center">
<v-col cols=10>
{{ $t('beg-for-data') }}
</v-col>
<v-col cols=10>
<v-tabs
v-model="os"
>
<v-tab
v-for="instr in instructions"
:key="instr.caption"
>
<v-icon>{{ instr.icon }}</v-icon>
{{ instr.caption }}
</v-tab>
</v-tabs>
<v-tabs-items v-model="os">
<v-tab-item
v-for="instr in instructions"
:key="instr.caption"
>
<v-card>
<v-card-text v-html="$t(instr.text)" />
</v-card>
</v-tab-item>
</v-tabs-items>
</v-col>
<v-col align="center" cols=10 lg=8>
<v-file-input
accept=".pdb"
show-size
counter
multiple
:label="$t('pokerth-logfiles')"
prepend-icon="mdi-database-outline"
v-model="files"
/>
</v-col>
<v-col align="center" cols=4>
<v-btn
:disabled="noSubmit || noFilesSelected"
@click="submit"
>{{ $t('submit-files') }}</v-btn>
</v-col>
</v-row>
</v-container>
</template>
<script>
export default {
name: 'FileChooser',
data() {
return {
files: [],
errorOccured: false,
noSubmit: false,
os: null,
instructions: [
{
icon: 'mdi-linux',
caption: 'Linux',
text: 'instructions-linux',
},
{
icon: 'mdi-microsoft-windows',
caption: 'Windows',
text: 'instructions-win',
},
{
icon: 'mdi-apple',
caption: 'MacOS',
text: 'instructions-mac',
},
],
};
},
computed: {
noFilesSelected() {
return this.files.length === 0;
},
},
methods: {
async submit() {
this.noSubmit = true;
const formData = new FormData();
this.files.forEach((file) => {
formData.append('dbfiles', file, file.name);
});
let response;
try {
response = await this.$axios.$post('/api/gamedata', formData);
this.$emit('dataUpload', response);
} catch (error) {
this.errorOccured = true;
/* eslint-disable-next-line no-console */
console.error(error);
}
},
},
};
</script>