Skip to content

Commit

Permalink
fix: let's try a bookmark
Browse files Browse the repository at this point in the history
  • Loading branch information
joelhooks committed Oct 25, 2024
1 parent adf310f commit ac076e4
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 17 deletions.
14 changes: 7 additions & 7 deletions src/components/layouts/collection-page-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,9 @@ const CollectionPageLayout: React.FunctionComponent<

{/* TODO: fix bookmarks feature EGG-294 */}
{/* Start of action buttons block */}
{/* <div className="flex items-center justify-center mt-4 space-x-2 dark:text-gray-900 md:justify-start"> */}
{/* Bookmark button */}
{/* {toggle_favorite_url ? (
<div className="flex items-center justify-center mt-4 space-x-2 dark:text-gray-900 md:justify-start">
{/* Bookmark button */}
{toggle_favorite_url ? (
<button
onClick={() => {
if (clickable) {
Expand Down Expand Up @@ -559,10 +559,10 @@ const CollectionPageLayout: React.FunctionComponent<
</p>
</LoginForm>
</DialogButton>
)} */}
)}

{/* RSS button */}
{/* {rss_url ? (
{/* RSS button */}
{/* {rss_url ? (
<Link
href={rss_url}
onClick={() => {
Expand Down Expand Up @@ -592,7 +592,7 @@ const CollectionPageLayout: React.FunctionComponent<
</MembershipDialogButton>
</a>
)} */}
{/* </div> */}
</div>
{/* End of action buttons block */}

<div className="flex items-center justify-center w-full mt-5 md:hidden">
Expand Down
1 change: 1 addition & 0 deletions src/hooks/use-cio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const CioProvider: React.FunctionComponent<
setSubscriber(data)
cioIdentify(data.id)
})
.catch(() => {})
.finally(() => setLoadingSubscriber(false))
}, [])

Expand Down
4 changes: 4 additions & 0 deletions src/lib/playlists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ export async function loadPlaylist(slug: string, token?: string) {
published_at
access_state
visibility_state
toggle_favorite_url
favorited
state
tags {
name
Expand Down Expand Up @@ -294,6 +296,8 @@ export async function loadPlaylist(slug: string, token?: string) {
slug: slug,
}

console.log('query', token)

const graphQLClient = getGraphQLClient(token)

const {playlist} = await graphQLClient.request(query, variables)
Expand Down
12 changes: 7 additions & 5 deletions src/pages/api/cio/identify/[id].ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ const cioIdentify = async (req: NextApiRequest, res: NextApiResponse) => {
Authorization: `Basic ${ENCODED_CUSTOMER_IO_TRACKING_API_CREDENTIALS}`,
}

await axios.put(
`https://track.customer.io/api/v1/customers/${id}`,
{...options, _update: true},
{headers},
)
await axios
.put(
`https://track.customer.io/api/v1/customers/${id}`,
{...options, _update: true},
{headers},
)
.catch(() => {})

const cioCookie = serverCookie.serialize(CIO_IDENTIFIER_KEY, id, {
secure: process.env.NODE_ENV === 'production',
Expand Down
7 changes: 6 additions & 1 deletion src/pages/courses/[course]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,12 @@ export const getServerSideProps: GetServerSideProps = async ({
}) => {
setupHttpTracing({name: getServerSideProps.name, tracer, req, res})
try {
const course = params && (await loadPlaylist(params.course as string))
const course =
params &&
(await loadPlaylist(
params.course as string,
req.cookies[ACCESS_TOKEN_KEY],
))

const courseSlug = getSlugFromPath(course?.path)
if (course && courseSlug !== params?.course) {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/analytics/identify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const identify = async (data: Viewer, properties?: any) => {
mixpanel.opt_out_tracking()
}
} catch (e) {
console.error('caught error in identify', e)
// console.error('caught error in identify', e)
return Promise.resolve(false)
}

Expand Down
5 changes: 2 additions & 3 deletions src/utils/analytics/track.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {isFunction, isUndefined} from 'lodash'
import {Viewer} from '@/types'
import Auth from '../auth'
import mixpanel from 'mixpanel-browser'
import posthog from 'posthog-js'
import {identify} from './identify'
import PosthogClient from '@/lib/posthog-client'
const DEBUG_ANALYTICS = true
Expand Down Expand Up @@ -77,13 +76,13 @@ export const track = (
try {
window._cio.track(event, params)
} catch (e) {
console.error('caught error', e)
// console.error('caught error', e)
}
}

politelyExit()
} catch (e) {
console.error('caught error', e)
// console.error('caught error', e)
resolve(false)
}
})
Expand Down

0 comments on commit ac076e4

Please sign in to comment.