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.
 
 
 
 
 
 

203 lines
4.4 KiB

<!--
/**
* Schedule View - Platform Neutral Scheduling Interface
*
* @author Matthew Raymer
* @version 1.0.0
*/
-->
<template>
<div class="schedule-view">
<div class="view-header">
<h1 class="page-title">📅 Schedule Notification</h1>
<p class="page-subtitle">Schedule a new daily notification</p>
</div>
<div class="schedule-form">
<div class="form-group">
<label class="form-label">Notification Time</label>
<input type="time" class="form-input" v-model="scheduleTime" />
</div>
<div class="form-group">
<label class="form-label">Title</label>
<input type="text" class="form-input" v-model="notificationTitle" placeholder="Daily Update" />
</div>
<div class="form-group">
<label class="form-label">Message</label>
<textarea class="form-textarea" v-model="notificationMessage" placeholder="Your daily notification message"></textarea>
</div>
<div class="form-actions">
<button class="action-button primary" @click="scheduleNotification" :disabled="isScheduling">
{{ isScheduling ? 'Scheduling...' : 'Schedule Notification' }}
</button>
</div>
</div>
</div>
</template>
<script lang="ts">
import { Vue, Component, toNative } from 'vue-facing-decorator'
@Component
class ScheduleView extends Vue {
scheduleTime = '09:00'
notificationTitle = 'Daily Update'
notificationMessage = 'Your daily notification is ready!'
isScheduling = false
async scheduleNotification() {
this.isScheduling = true
try {
console.log('🔄 Starting notification scheduling...')
// Import and use the real plugin
const { DailyNotification } = await import('@timesafari/daily-notification-plugin')
const plugin = DailyNotification
console.log('✅ Plugin loaded:', plugin)
const options = {
time: this.scheduleTime,
title: this.notificationTitle,
body: this.notificationMessage,
sound: true,
priority: 'high' as const
}
console.log('📅 Scheduling notification with options:', options)
await plugin.scheduleDailyNotification(options)
console.log('✅ Notification scheduled successfully!')
// Show success feedback to user
alert('Notification scheduled successfully!')
} catch (error) {
console.error('❌ Failed to schedule notification:', error)
console.error('❌ Error details:', {
name: error.name,
message: error.message,
stack: error.stack
})
// Show error feedback to user
alert(`Failed to schedule notification: ${error.message}`)
} finally {
this.isScheduling = false
}
}
}
export default toNative(ScheduleView)
</script>
<style scoped>
.schedule-view {
padding: 20px;
max-width: 600px;
margin: 0 auto;
}
.view-header {
text-align: center;
margin-bottom: 30px;
}
.page-title {
margin: 0 0 8px 0;
font-size: 28px;
font-weight: 700;
color: white;
}
.page-subtitle {
margin: 0;
font-size: 16px;
color: rgba(255, 255, 255, 0.8);
}
.schedule-form {
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 12px;
padding: 24px;
backdrop-filter: blur(10px);
}
.form-group {
margin-bottom: 20px;
}
.form-label {
display: block;
margin-bottom: 8px;
font-size: 14px;
font-weight: 500;
color: white;
}
.form-input, .form-textarea {
width: 100%;
padding: 12px;
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 8px;
background: rgba(255, 255, 255, 0.1);
color: white;
font-size: 14px;
transition: border-color 0.2s ease;
}
.form-input:focus, .form-textarea:focus {
outline: none;
border-color: rgba(255, 255, 255, 0.4);
}
.form-textarea {
min-height: 80px;
resize: vertical;
}
.form-actions {
margin-top: 24px;
}
.action-button {
width: 100%;
padding: 14px;
border: none;
border-radius: 8px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s ease;
}
.action-button.primary {
background: #1976d2;
color: white;
}
.action-button.primary:hover:not(:disabled) {
background: #1565c0;
}
.action-button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* Mobile responsiveness */
@media (max-width: 768px) {
.schedule-view {
padding: 16px;
}
.schedule-form {
padding: 20px;
}
}
</style>