import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { 
  IonHeader, 
  IonToolbar, 
  IonTitle, 
  IonContent,
  IonCard,
  IonCardContent,
  IonCardHeader,
  IonCardTitle,
  IonGrid,
  IonRow,
  IonCol,
  IonIcon,
  IonItem,
  IonLabel,
  IonBadge,
  IonProgressBar
} from '@ionic/angular/standalone';
import { NgIf } from '@angular/common';
import { addIcons } from 'ionicons';
import { 
  notifications, 
  bulb, 
  barChart, 
  people, 
  star 
} from 'ionicons/icons';

interface Notification {
  id: number;
  content: string;
  date: Date;
}

@Component({
  selector: 'app-tab2',
  templateUrl: 'tab2.page.html',
  styleUrls: ['tab2.page.scss'],
  standalone: true,
  imports: [
    IonHeader, 
    IonToolbar, 
    IonTitle, 
    IonContent,
    IonCard,
    IonCardContent,
    IonCardHeader,
    IonCardTitle,
    IonGrid,
    IonRow,
    IonCol,
    IonIcon,
    IonItem,
    IonLabel,
    IonBadge,
    IonProgressBar,
    NgIf
  ]
})
export class Tab2Page implements OnInit {
  notifications: Notification[] = [];
  dailyProgress: number = 0.65; // 示例进度
  completedTasks: number = 13;
  totalTasks: number = 20;

  constructor(private router: Router) {
    addIcons({ 
      notifications, 
      bulb, 
      barChart, 
      people, 
      star 
    });
  }

  ngOnInit() {
    // 模拟获取通知数据
    this.notifications = [
      {
        id: 1,
        content: '你有一个新的学习任务待完成',
        date: new Date()
      }
    ];
  }

  navigateToFeature(feature: string) {
    // 处理导航逻辑
    console.log(`Navigating to ${feature}`);
    // this.router.navigate([`/tabs/tab2/${feature}`]);
  }
}
