Commit eadb913e authored by M. Esat Akpunar's avatar M. Esat Akpunar

Add initial implementation of template previewer application

- Created project structure for a Vue.js application with Vite.
- Added main application files including App.vue, main.js, and components.
- Implemented HTML and PDF preview functionality with Monaco Editor for template and data source input.
- Configured environment variables and added .env files for API base URL.
- Included necessary dependencies in package.json for Vue, Vite, and other libraries.
- Established a responsive layout with Tailwind CSS and custom styles.
- Added README and PRD documentation for project overview and requirements.
parents
# HTML ve PDF Önizleyici PRD
## Proje Amacı
Bu proje, kullanıcıların HTML template'lerini ve veri kaynaklarını girerek, sonuçları hem HTML hem de PDF formatında önizleyebilecekleri bir web uygulamasıdır.
## Kullanıcı Arayüzü Gereksinimleri
### Ana Sayfa Düzeni
- Sayfa dikey olarak iki ana bölüme ayrılacak:
1. Sol Panel
2. Sağ Panel
### Sol Panel Özellikleri
1. HTML Template Giriş Alanı
- Geniş bir metin editörü
- Syntax highlighting desteği
- Template değişkenlerini vurgulama
2. Data Source Giriş Alanı
- JSON formatında veri girişi
- Syntax highlighting desteği
- JSON validasyonu
3. Kontrol Butonları
- "Run" butonu
- Template ve veri kaynağını backend'e gönderme
### Sağ Panel Özellikleri
1. Sekmeli Görünüm
- HTML Önizleme sekmesi
- PDF Önizleme sekmesi
2. HTML Önizleme
- Template ve veri kaynağının birleştirilmiş sonucu
- Responsive görünüm
3. PDF Önizleme
- PDF dosyasının önizlemesi
- Zoom in/out özellikleri
## Teknik Gereksinimler
- Frontend Framework: Vue.js
- UI Kütüphanesi: Tailwind CSS
- Code Editor: Monaco Editor
- PDF Görüntüleyici: PDF.js
- Responsive tasarım
- Modern ve kullanıcı dostu arayüz
- Dark/Light mode desteği
- Error notification sistemi
- Detaylı hata yönetimi ve görüntüleme
## Backend Entegrasyonu
- API Endpoint: `/report/pdfTest`
- Request Format:
```json
{
"template": "HTML template string",
"dataSource": "JSON data string"
}
```
- Response Format:
```json
{
"htmlContent": "Rendered HTML string",
"pdfContent": "PDF byte array"
}
```
## Kullanıcı Deneyimi
- Yükleme durumları için loading göstergeleri
- Hata mesajları için toast bildirimleri
- Kullanıcı dostu hata yönetimi
- Responsive tasarım ile mobil uyumluluk
- Dark/Light mode geçiş özelliği
- Detaylı hata mesajları ve bildirimler
## Güvenlik Gereksinimleri
- XSS koruması
- Input validasyonu
- Rate limiting
- CORS politikaları
- Base64 to blob dönüşüm güvenliği
\ No newline at end of file
VITE_API_BASE_URL=https://mars.reybex.com/api
\ No newline at end of file
VITE_API_BASE_URL=https://mars.reybex.com/api
# Configuration Notes:
# VITE_API_BASE_URL: Base URL for the API
\ No newline at end of file
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
.DS_Store
dist
dist-ssr
coverage
*.local
/cypress/videos/
/cypress/screenshots/
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
*.tsbuildinfo
{
"recommendations": ["Vue.volar"]
}
# template-previewer
This template should help get you started developing with Vue 3 in Vite.
## Recommended IDE Setup
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
## Customize configuration
See [Vite Configuration Reference](https://vite.dev/config/).
## Project Setup
```sh
npm install
```
### Compile and Hot-Reload for Development
```sh
npm run dev
```
### Compile and Minify for Production
```sh
npm run build
```
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Template Previewer</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
},
"exclude": ["node_modules", "dist"]
}
This diff is collapsed.
{
"name": "template-previewer",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"@monaco-editor/loader": "^1.3.2",
"@vueuse/core": "^10.3.0",
"autoprefixer": "^10.4.16",
"axios": "^1.6.2",
"monaco-editor": "^0.45.0",
"pdfjs-dist": "^3.11.174",
"postcss": "^8.4.31",
"primeicons": "^6.0.1",
"primevue": "^3.38.0",
"splitpanes": "^4.0.3",
"tailwindcss": "^3.3.5",
"toastify-js": "^1.12.0",
"vue": "^3.3.4",
"vue-router": "^4.2.4"
},
"devDependencies": {
"@types/node": "^20.8.9",
"@vitejs/plugin-vue": "^4.3.4",
"vite": "^4.4.11",
"vite-plugin-vue-devtools": "^7.0.0"
}
}
This diff is collapsed.
/* color palette from <https://github.com/vuejs/theme> */
:root {
--vt-c-white: #ffffff;
--vt-c-white-soft: #f8f8f8;
--vt-c-white-mute: #f2f2f2;
--vt-c-black: #181818;
--vt-c-black-soft: #222222;
--vt-c-black-mute: #282828;
--vt-c-indigo: #2c3e50;
--vt-c-divider-light-1: rgba(60, 60, 60, 0.29);
--vt-c-divider-light-2: rgba(60, 60, 60, 0.12);
--vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
--vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);
--vt-c-text-light-1: var(--vt-c-indigo);
--vt-c-text-light-2: rgba(60, 60, 60, 0.66);
--vt-c-text-dark-1: var(--vt-c-white);
--vt-c-text-dark-2: rgba(235, 235, 235, 0.64);
}
/* semantic color variables for this project */
:root {
--color-background: var(--vt-c-white);
--color-background-soft: var(--vt-c-white-soft);
--color-background-mute: var(--vt-c-white-mute);
--color-border: var(--vt-c-divider-light-2);
--color-border-hover: var(--vt-c-divider-light-1);
--color-heading: var(--vt-c-text-light-1);
--color-text: var(--vt-c-text-light-1);
--section-gap: 160px;
}
@media (prefers-color-scheme: dark) {
:root {
--color-background: var(--vt-c-black);
--color-background-soft: var(--vt-c-black-soft);
--color-background-mute: var(--vt-c-black-mute);
--color-border: var(--vt-c-divider-dark-2);
--color-border-hover: var(--vt-c-divider-dark-1);
--color-heading: var(--vt-c-text-dark-1);
--color-text: var(--vt-c-text-dark-2);
}
}
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
font-weight: normal;
}
body {
min-height: 100vh;
color: var(--color-text);
background: var(--color-background);
transition:
color 0.5s,
background-color 0.5s;
line-height: 1.6;
font-family:
Inter,
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
Roboto,
Oxygen,
Ubuntu,
Cantarell,
'Fira Sans',
'Droid Sans',
'Helvetica Neue',
sans-serif;
font-size: 15px;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 261.76 226.69"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/></svg>
@import './base.css';
:root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;
color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
margin: 0;
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
}
#app {
width: 100%;
height: 100vh;
}
a,
.green {
text-decoration: none;
color: hsla(160, 100%, 37%, 1);
transition: 0.4s;
padding: 3px;
}
@media (hover: hover) {
a:hover {
background-color: hsla(160, 100%, 37%, 0.2);
}
}
@media (min-width: 1024px) {
body {
display: flex;
place-items: center;
}
#app {
display: grid;
grid-template-columns: 1fr 1fr;
padding: 0 2rem;
}
}
<template>
<div ref="editorContainer" class="monaco-editor"></div>
</template>
<script setup>
import { ref, onMounted, watch, onBeforeUnmount } from 'vue'
import * as monaco from 'monaco-editor'
import loader from '@monaco-editor/loader'
const props = defineProps({
modelValue: {
type: String,
default: ''
},
language: {
type: String,
default: 'javascript'
},
theme: {
type: String,
default: 'vs-dark'
},
options: {
type: Object,
default: () => ({})
}
})
const emit = defineEmits(['update:modelValue'])
const editorContainer = ref(null)
let editor = null
onMounted(async () => {
await loader.init()
editor = monaco.editor.create(editorContainer.value, {
value: props.modelValue,
language: props.language,
theme: props.theme,
automaticLayout: true,
...props.options
})
editor.onDidChangeModelContent(() => {
const value = editor.getValue()
emit('update:modelValue', value)
})
})
watch(() => props.modelValue, (newValue) => {
if (editor && newValue !== editor.getValue()) {
editor.setValue(newValue)
}
})
watch(() => props.language, (newValue) => {
if (editor) {
monaco.editor.setModelLanguage(editor.getModel(), newValue)
}
})
watch(() => props.theme, (newValue) => {
if (editor) {
monaco.editor.setTheme(newValue)
}
})
onBeforeUnmount(() => {
if (editor) {
editor.dispose()
}
})
</script>
<style scoped>
.monaco-editor {
width: 100%;
height: 100%;
}
</style>
\ No newline at end of file
import './assets/main.css'
import { createApp } from 'vue'
import App from './App.vue'
import PrimeVue from 'primevue/config'
import ToastService from 'primevue/toastservice'
import 'primevue/resources/themes/lara-light-blue/theme.css'
import 'primevue/resources/primevue.min.css'
import 'primeicons/primeicons.css'
import 'toastify-js/src/toastify.css'
const app = createApp(App)
app.use(PrimeVue)
app.use(ToastService)
app.mount('#app')
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
// https://vite.dev/config/
export default defineConfig({
plugins: [
vue(),
vueDevTools(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
},
},
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment