CarPlay brain blast

This commit is contained in:
Violet Caulfield
2025-02-10 16:02:44 -06:00
parent 081f84078d
commit f377433677
2 changed files with 21 additions and 9 deletions

View File

@@ -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;

View File

@@ -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)