Files
shtil/poc/helper-tray/src/App.vue
T

138 lines
2.9 KiB
Vue
Raw Normal View History

<script setup lang="ts">
import { onMounted, ref } from "vue";
import { invoke } from "@tauri-apps/api/core";
import { getCurrentWebviewWindow } from "@tauri-apps/api/webviewWindow";
// Окна создаются с меткой win-<view>-<n>: view — report | tickets | about.
const view = getCurrentWebviewWindow().label.split("-")[1] ?? "report";
const categories = [
"Не работает программа",
"Компьютер или оборудование",
"Интернет и сеть",
"Другое",
];
const category = ref("");
const description = ref("");
const sent = ref(false);
onMounted(() => {
// Двойной rAF: вторая рамка гарантирует, что первая уже отрисована.
requestAnimationFrame(() => {
requestAnimationFrame(() => {
void invoke("first_paint");
});
});
});
</script>
<template>
<main class="page">
<template v-if="view === 'report'">
<h1>Сообщить о проблеме</h1>
<div class="categories">
<button
v-for="c in categories"
:key="c"
:class="{ active: category === c }"
@click="category = c"
>
{{ c }}
</button>
</div>
<textarea
v-model="description"
rows="6"
placeholder="Опишите, что случилось"
></textarea>
<button
class="send"
:disabled="!category || !description.trim()"
@click="sent = true"
>
Отправить
</button>
<p v-if="sent" class="note">Отправка не выполняется — это прототип.</p>
</template>
<template v-else-if="view === 'tickets'">
<h1>Мои обращения</h1>
<p class="note">Заглушка прототипа. Здесь будет список обращений.</p>
</template>
<template v-else>
<h1>О программе</h1>
<p class="note">«Штиль Помощник» — прототип для замеров (#1.8).</p>
</template>
</main>
</template>
<style scoped>
.page {
padding: 20px;
display: flex;
flex-direction: column;
gap: 14px;
}
h1 {
font-size: 18px;
margin: 0;
}
.categories {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
}
button {
border: 1px solid #c7c7c7;
border-radius: 8px;
padding: 10px;
font: inherit;
background: #fff;
cursor: pointer;
}
button.active {
border-color: #2f6fdb;
background: #e8f0fc;
}
textarea {
font: inherit;
border: 1px solid #c7c7c7;
border-radius: 8px;
padding: 10px;
resize: vertical;
}
.send {
background: #2f6fdb;
color: #fff;
border-color: #2f6fdb;
}
.send:disabled {
opacity: 0.5;
cursor: default;
}
.note {
color: #666;
margin: 0;
}
</style>
<style>
:root {
font-family: "Segoe UI", system-ui, sans-serif;
font-size: 15px;
color: #1a1a1a;
}
body {
margin: 0;
}
</style>