refactor, go work

This commit is contained in:
ctengiz
2024-03-25 11:30:06 +03:00
parent e78ff14861
commit 1f62906e95
47 changed files with 40 additions and 241 deletions

24
app/frontend/.gitignore vendored Normal file
View File

@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

3
app/frontend/.vscode/extensions.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
}

View File

@@ -0,0 +1,13 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
import {Call} from '@wailsio/runtime';
/**
* @function ClaimFile
* @returns {Promise<string>}
**/
export async function ClaimFile() {
return Call.ByName("main.BotService.ClaimFile", ...Array.prototype.slice.call(arguments, 0));
}

View File

@@ -0,0 +1,18 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
import {Call} from '@wailsio/runtime';
/**
* @typedef {import('./models').LoginUser} LoginUser
*/
/**
* @function Login
* @param userName {string}
* @param password {string}
* @returns {Promise<LoginUser>}
**/
export async function Login(userName, password) {
return Call.ByName("main.LoginService.Login", ...Array.prototype.slice.call(arguments, 0));
}

View File

@@ -0,0 +1,33 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export const LoginUser = class {
/**
* Creates a new LoginUser instance.
* @constructor
* @param {Object} source - The source object to create the LoginUser.
* @param {string} source.UserName
* @param {string} source.password
* @param {string} source.Token
* @param {boolean} source.LoggedIn
*/
constructor(source = {}) {
const { userName = "", password = "", token = "", loggedIn = false } = source;
this.userName = userName;
this.password = password;
this.token = token;
this.loggedIn = loggedIn;
}
/**
* Creates a new LoginUser instance from a string or object.
* @param {string|object} source - The source data to create a LoginUser instance from.
* @returns {LoginUser} A new LoginUser instance.
*/
static createFrom(source) {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new LoginUser(parsedSource);
}
};

14
app/frontend/index.html Normal file
View File

@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/wails.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- <link rel="stylesheet" href="/style.css" /> -->
<title>Wails + Vue</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>

21
app/frontend/main.js Normal file
View File

@@ -0,0 +1,21 @@
import {Greet} from "./bindings/main/BotService.js";
import {Events} from "@wailsio/runtime";
const resultElement = document.getElementById('result');
const timeElement = document.getElementById('time');
window.doGreet = () => {
let name = document.getElementById('name').value;
if (!name) {
name = 'anonymous';
}
Greet(name).then((result) => {
resultElement.innerText = result;
}).catch((err) => {
console.log(err);
});
}
Events.On('time', (time) => {
timeElement.innerText = time.data;
});

1524
app/frontend/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

22
app/frontend/package.json Normal file
View File

@@ -0,0 +1,22 @@
{
"name": "frontend",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"bootstrap": "^5.3.3",
"bootstrap-icons-vue": "^1.11.3",
"vue": "^3.2.45",
"vue-router": "^4.3.0"
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.0.0",
"@wailsio/runtime": "latest",
"vite": "^5.0.0"
}
}

Binary file not shown.

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="32" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path fill="#F7DF1E" d="M0 0h256v256H0V0Z"></path><path d="m67.312 213.932l19.59-11.856c3.78 6.701 7.218 12.371 15.465 12.371c7.905 0 12.89-3.092 12.89-15.12v-81.798h24.057v82.138c0 24.917-14.606 36.259-35.916 36.259c-19.245 0-30.416-9.967-36.087-21.996m85.07-2.576l19.588-11.341c5.157 8.421 11.859 14.607 23.715 14.607c9.969 0 16.325-4.984 16.325-11.858c0-8.248-6.53-11.17-17.528-15.98l-6.013-2.58c-17.357-7.387-28.87-16.667-28.87-36.257c0-18.044 13.747-31.792 35.228-31.792c15.294 0 26.292 5.328 34.196 19.247l-18.732 12.03c-4.125-7.389-8.591-10.31-15.465-10.31c-7.046 0-11.514 4.468-11.514 10.31c0 7.217 4.468 10.14 14.778 14.608l6.014 2.577c20.45 8.765 31.963 17.7 31.963 37.804c0 21.654-17.012 33.51-39.867 33.51c-22.339 0-36.774-10.654-43.819-24.574"></path></svg>

After

Width:  |  Height:  |  Size: 995 B

View File

@@ -0,0 +1,146 @@
:root {
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
"Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
font-size: 16px;
line-height: 24px;
font-weight: 400;
color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: rgba(27, 38, 54, 1);
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
}
* {
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 400;
src: local(""),
url("./Inter-Medium.ttf") format("truetype");
}
h3 {
font-size: 3em;
line-height: 1.1;
}
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}
button {
width: 60px;
height: 30px;
line-height: 30px;
border-radius: 3px;
border: none;
margin: 0 0 0 20px;
padding: 0 8px;
cursor: pointer;
}
.result {
height: 20px;
line-height: 20px;
}
body {
margin: 0;
display: flex;
place-items: center;
place-content: center;
min-width: 320px;
min-height: 100vh;
}
.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
h1 {
font-size: 3.2em;
line-height: 1.1;
}
#app {
max-width: 1280px;
margin: 0 auto;
text-align: center;
}
.result {
height: 20px;
line-height: 20px;
margin: 1.5rem auto;
text-align: center;
}
.footer {
margin-top: 1rem;
align-content: center;
text-align: center;
color: rgba(255, 255, 255, 0.67);
}
@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
a:hover {
color: #747bff;
}
button {
background-color: #f9f9f9;
}
}
.input-box .btn:hover {
background-image: linear-gradient(to top, #cfd9df 0%, #e2ebf0 100%);
color: #333333;
}
.input-box .input {
border: none;
border-radius: 3px;
outline: none;
height: 30px;
line-height: 30px;
padding: 0 10px;
color: black;
background-color: rgba(240, 240, 240, 1);
-webkit-font-smoothing: antialiased;
}
.input-box .input:hover {
border: none;
background-color: rgba(255, 255, 255, 1);
}
.input-box .input:focus {
border: none;
background-color: rgba(255, 255, 255, 1);
}

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>

After

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

23
app/frontend/src/App.vue Normal file
View File

@@ -0,0 +1,23 @@
<script setup>
</script>
<template>
<div class="container">
<router-view></router-view>
<!-- <LoginPage msg="Wails + Vue" /> -->
</div>
</template>
<style scoped>
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
}
.logo:hover {
filter: drop-shadow(0 0 2em #e80000aa);
}
.logo.vue:hover {
filter: drop-shadow(0 0 2em #42b883aa);
}
</style>

View File

@@ -0,0 +1,36 @@
<template>
<div class="container d-flex justify-content-center align-items-center" style="height: 100vh;">
<form @submit.prevent="submitForm">
<div class="mb-3">
<button type="button" class="btn btn-primary" @click="openFileDialog">
<b-icon-file-earmark-excel />
Dosya Seç
</button>
</div>
</form>
</div>
</template>
<script>
import {ClaimFile} from "../../bindings/main/BotService.js";
export default {
methods: {
openFileDialog() {
ClaimFile().then((resultValue) => {
let value = resultValue;
if(value != '')
{
alert("Dosya Seçildi")
}
}).catch((err) => {
alert("Dosya Seçilemedi")
console.log(err);
});
}
}
};
</script>
<style>
/* Add custom styles here if needed */
</style>

View File

@@ -0,0 +1,78 @@
<template>
<div class="login">
<h2 class="mb-4">Luca Girişi</h2>
<form @submit.prevent="login">
<div class="form-group">
<label for="username">Kullanıcı Adı:</label>
<input type="text" id="username" class="form-control" v-model="username" required>
</div>
<div class="form-group">
<label for="password">Şifre:</label>
<input type="password" id="password" class="form-control" v-model="password" required>
</div>
<button style="margin-top: 15px;" type="submit" class="btn btn-primary">Login</button>
</form>
</div>
</template>
<script>
import {Login} from "../../bindings/main/LoginService.js";
export default {
data() {
return {
username: '',
password: ''
};
},
methods: {
login() {
let that = this
Login(this.username, this.password).then((resultValue) => {
let value = resultValue;
console.log("entered")
if(value.LoggedIn)
{
that.$router.push({ name: 'Dashboard' });
}
}).catch((err) => {
console.log(err);
});
}
}
};
</script>
<!--
<script setup>
import { ref, onMounted } from 'vue'
import {Login} from "../../bindings/main/LoginService";
import {Events} from "@wailsio/runtime";
const name = ref('')
const result = ref('Please enter your name below 👇')
const time = ref('Listening for Time event...')
const doLogin = () => {
let localName = name.value;
if (!localName) {
localName = 'anonymous';
}
Login(localName).then((resultValue) => {
result.value = resultValue;
}).catch((err) => {
console.log(err);
});
}
onMounted(() => {
Events.On('time', (timeValue) => {
time.value = timeValue.data;
});
})
defineProps({
msg: String,
})
</script> -->

38
app/frontend/src/main.js Normal file
View File

@@ -0,0 +1,38 @@
import { createApp } from 'vue';
import App from './App.vue';
import { createRouter, createWebHistory } from 'vue-router'; // Import Vue Router
import 'bootstrap/dist/css/bootstrap.min.css';
import { BootstrapIconsPlugin } from "bootstrap-icons-vue";
// Import components for routing
import LoginPage from './components/LoginPage.vue';
import Dashboard from './components/Dashboard.vue'; // Assuming you have a Dashboard view
// Define routes
const routes = [
{ path: '/Dashboard',
name: 'Dashboard',
components : {
default : Dashboard
}
}, // Route to Dashboard
{ path: '/',
name: 'LoginPage',
components : {
default : LoginPage
}
}, // Route to Login
// You can define more routes here
];
// Create router instance
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes,
});
// Create Vue app and use router
const app = createApp(App);
app.use(BootstrapIconsPlugin);
app.use(router);
app.mount('#app');

View File

@@ -0,0 +1,7 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
})