diff --git a/packages/audius-mobile-client/src/models/Track.ts b/packages/audius-mobile-client/src/models/Track.ts index e4007c4d81..ce589a9277 100644 --- a/packages/audius-mobile-client/src/models/Track.ts +++ b/packages/audius-mobile-client/src/models/Track.ts @@ -53,53 +53,50 @@ export type TrackImage = { cover_art_sizes: Nullable } -export type TrackId = { +export type TrackMetadata = TrackImage & { track_id: number - route_id: string -} - -export type TrackMetadata = TrackImage & - TrackId & { - blocknumber: number - activity_timestamp?: string - is_delete: boolean - created_at: string - isrc: Nullable - iswc: Nullable - credits_splits: Nullable - description: Nullable - followee_reposts: Repost[] - followee_saves: Favorite[] - genre: string - has_current_user_reposted: boolean - has_current_user_saved: boolean - download: Nullable - license: Nullable - mood: Nullable - play_count: number - owner_id: ID - release_date: Nullable - repost_count: number - save_count: number - tags: Nullable - title: string - track_segments: TrackSegment[] - is_unlisted: boolean - field_visibility?: FieldVisibility - listenCount?: number - - // Optional Fields - is_invalid?: boolean - stem_of?: { - parent_track_id: ID - category: StemCategory - } - remix_of: Nullable - - // Added fields - dateListened?: string - duration: number - } & Timestamped + blocknumber: number + activity_timestamp?: string + is_delete: boolean + created_at: string + isrc: Nullable + iswc: Nullable + credits_splits: Nullable + description: Nullable + followee_reposts: Repost[] + followee_saves: Favorite[] + genre: string + has_current_user_reposted: boolean + has_current_user_saved: boolean + download: Nullable + license: Nullable + mood: Nullable + play_count: number + owner_id: ID + release_date: Nullable + repost_count: number + save_count: number + tags: Nullable + title: string + track_segments: TrackSegment[] + is_unlisted: boolean + field_visibility?: FieldVisibility + listenCount?: number + + permalink: string + + // Optional Fields + is_invalid?: boolean + stem_of?: { + parent_track_id: ID + category: StemCategory + } + remix_of: Nullable + + // Added fields + dateListened?: string + duration: number +} & Timestamped export type Stem = { track_id: ID diff --git a/packages/audius-mobile-client/src/store/search/types.ts b/packages/audius-mobile-client/src/store/search/types.ts index f85faaab45..cda348b201 100644 --- a/packages/audius-mobile-client/src/store/search/types.ts +++ b/packages/audius-mobile-client/src/store/search/types.ts @@ -1,4 +1,4 @@ -import { TrackImage, TrackId } from '../../models/Track' +import { TrackImage } from '../../models/Track' import { CollectionImage } from '../../models/Collection' import { UserImage, @@ -36,54 +36,54 @@ export type SearchUser = UserMultihash & user_id: number } -export type SearchTrack = TrackImage & - TrackId & { - description: string | null - genre: string - mood: string - release_date: null - remix_of: null - repost_count: number - tags: null - title: string - user: SearchUser - duration: number - play_count: null - blocknumber: number - create_date: null - created_at: string - credits_splits: null - download: { - cid: null - is_downloadable: false - requires_follow: false - } - isrc: null - license: null - iswc: null - field_visibility: { - mood: boolean - tags: boolean - genre: boolean - share: boolean - play_count: boolean - remixes: null - } - followee_reposts: {}[] - has_current_user_reposted: null - is_unlisted: boolean - has_current_user_saved: null - stem_of: null - updated_at: string - is_delete: boolean - track_id: number - owner_id: number - followee_saves: [] - save_count: null - track_segments: { duration: number; multihash: string }[] - followee_favorites: null - user_id: number +export type SearchTrack = TrackImage & { + description: string | null + genre: string + mood: string + release_date: null + remix_of: null + repost_count: number + tags: null + title: string + user: SearchUser + duration: number + play_count: null + blocknumber: number + create_date: null + created_at: string + credits_splits: null + download: { + cid: null + is_downloadable: false + requires_follow: false } + isrc: null + license: null + iswc: null + field_visibility: { + mood: boolean + tags: boolean + genre: boolean + share: boolean + play_count: boolean + remixes: null + } + followee_reposts: {}[] + has_current_user_reposted: null + is_unlisted: boolean + has_current_user_saved: null + stem_of: null + updated_at: string + is_delete: boolean + track_id: number + owner_id: number + followee_saves: [] + save_count: null + track_segments: { duration: number; multihash: string }[] + followee_favorites: null + user_id: number + permalink: string +} export type SearchPlaylist = CollectionImage & { description: string | null diff --git a/packages/audius-mobile-client/src/utils/routes.tsx b/packages/audius-mobile-client/src/utils/routes.tsx index e6400fe0fa..8ccad0263f 100644 --- a/packages/audius-mobile-client/src/utils/routes.tsx +++ b/packages/audius-mobile-client/src/utils/routes.tsx @@ -1,5 +1,5 @@ import Config from 'react-native-config' -import { TrackId } from '../models/Track' +import { TrackMetadata } from '../models/Track' import { UserCollection } from '../models/Collection' import { UserHandle } from '../models/User' @@ -37,8 +37,8 @@ export const encodeUrlName = (name: string) => { const AUDIUS_URL = Config.AUDIUS_URL -export const getTrackRoute = (track: TrackId, fullUrl = false) => { - const route = `/${track.route_id}-${track.track_id}` +export const getTrackRoute = (track: TrackMetadata, fullUrl = false) => { + const route = track.permalink return fullUrl ? `${AUDIUS_URL}${route}` : route }