From f377433677cdbd4233a5982619aca5467ab55b77 Mon Sep 17 00:00:00 2001 From: Violet Caulfield Date: Mon, 10 Feb 2025 16:02:44 -0600 Subject: [PATCH] CarPlay brain blast --- components/CarPlay/Home.tsx | 25 +++++++++++++++++-------- components/CarPlay/Navigation.tsx | 5 ++++- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/components/CarPlay/Home.tsx b/components/CarPlay/Home.tsx index b3103bc5..8ceefc49 100644 --- a/components/CarPlay/Home.tsx +++ b/components/CarPlay/Home.tsx @@ -1,17 +1,26 @@ +import Client from "../../api/client"; import { fetchRecentlyPlayedArtists } from "../../api/queries/functions/recents"; -import { GridTemplate } from "react-native-carplay"; +import { ListTemplate } from "react-native-carplay"; const recentArtists = fetchRecentlyPlayedArtists() -const CarPlayHome : GridTemplate = new GridTemplate({ +const CarPlayHome : ListTemplate = new ListTemplate({ + id: 'Home', title: "Home", tabTitle: "Home", - buttons: Array.from({ length: 8 }).map((_, i) => ({ - id: `BUTTON_${i}`, - image: require("../../assets/icon_60pt_3x.jpg"), - titleVariants: [`Item ${i}`] - })), - id: 'Home' + sections: [ + { + header: Client.user!.name, + items: [ + { text: 'Recent Artists' }, + { text: 'Recently Played'}, + { text: 'Your Playlists'} + ] + } + ], + // onItemSelect: (item) => { + + // } }); export default CarPlayHome; \ No newline at end of file diff --git a/components/CarPlay/Navigation.tsx b/components/CarPlay/Navigation.tsx index 821350d6..9ce79653 100644 --- a/components/CarPlay/Navigation.tsx +++ b/components/CarPlay/Navigation.tsx @@ -1,8 +1,11 @@ import { CarPlay, TabBarTemplate } from "react-native-carplay"; +import CarPlayHome from "./Home"; const CarPlayNavigation : TabBarTemplate = new TabBarTemplate({ title: 'Navigation', - templates: [], + templates: [ + CarPlayHome + ], onTemplateSelect(template, e) { if (template) CarPlay.pushTemplate(template, true)