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

@Component({
  selector: 'app-my',
  templateUrl: 'Tab3.page.html',
  styleUrls: ['Tab3.page.scss'],
})
export class Tab3Page {
  segment = 'posts';
  searchQuery = '';
  searchHistory = ['历史搜索项1', '历史搜索项2'];
  searchSuggestions = ['猜你想搜1', '猜你想搜2', '猜你想搜3'];
  popularRooms = [
    { image: 'https://example.com/room1.jpg', title: '房间1', subtitle: 'subtitle1' },
    { image: 'https://example.com/room2.jpg', title: '房间2', subtitle: 'subtitle2' },
    
  ];
  isSearching: boolean | undefined;

  constructor(private navCtrl: NavController) {}

  goToEditInfo() {
    this.navCtrl.navigateForward('/edit-info');
  }

  showSearch() {
    this.isSearching = true;
  }

  hideSearch() {
    this.isSearching = false;
    this.searchQuery = '';
  }

  filterChats() {
    // Implement your search logic here
  }

  segmentChanged(event: any) {
    this.segment = event.detail.value;
  }
   
  goToLogin() {
    this.navCtrl.navigateForward('/login');
    console.log('Navigating to Login page');
  }

  gotoDynamic(){
    this.navCtrl.navigateForward('/dynamic');
  }
}
