import { Component } from '@angular/core';
import { NavController } from '@ionic/angular';
import { Router } from '@angular/router';

@Component({
  selector: 'app-tab1',
  templateUrl: 'tab1.page.html',
  styleUrls: ['tab1.page.scss']
})
export class Tab1Page {
  contacts: { username: string, avatar: string, lastMessageTime: string, lastMessage: string }[] = [
    {
      username: 'Alice',
      avatar: 'assets/1.png',
      lastMessageTime: '10:30 AM',
      lastMessage: 'Hey, how are you?',
    },
    {
      username: 'Bob',
      avatar: 'assets/时钟.png',
      lastMessageTime: 'Yesterday',
      lastMessage: 'Let\'s meet tomorrow.',
    },
    // Add more contacts as needed
  ];

  constructor(private navCtrl: NavController) {}

  openChat(contact: { username: string, avatar: string, lastMessageTime: string, lastMessage: string }) {
    this.navCtrl.navigateForward(`chat-test1/${contact.username}`);
}

}