Event for show
This commit is contained in:
@@ -236,4 +236,9 @@ export type LogEvents = {
|
|||||||
'tmd:share': {}
|
'tmd:share': {}
|
||||||
'tmd:download': {}
|
'tmd:download': {}
|
||||||
'tmd:post': {}
|
'tmd:post': {}
|
||||||
|
|
||||||
|
'trendingTopics:show': {}
|
||||||
|
'trendingTopics:hide': {
|
||||||
|
context: 'sidebar' | 'discover' | 'explore'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
|
import {logEvent} from '#/lib/statsig/statsig'
|
||||||
import * as persisted from '#/state/persisted'
|
import * as persisted from '#/state/persisted'
|
||||||
|
|
||||||
type StateContext = {
|
type StateContext = {
|
||||||
@@ -26,7 +27,11 @@ function usePersistedBooleanValue<T extends keyof persisted.Schema>(key: T) {
|
|||||||
(value: Exclude<persisted.Schema[T], undefined>) => void
|
(value: Exclude<persisted.Schema[T], undefined>) => void
|
||||||
>(
|
>(
|
||||||
hidden => {
|
hidden => {
|
||||||
_set(Boolean(hidden))
|
const hide = Boolean(hidden)
|
||||||
|
if (!hide) {
|
||||||
|
logEvent('trendingTopics:show', {})
|
||||||
|
}
|
||||||
|
_set(hide)
|
||||||
persisted.write(key, hidden)
|
persisted.write(key, hidden)
|
||||||
},
|
},
|
||||||
[key, _set],
|
[key, _set],
|
||||||
|
|||||||
Reference in New Issue
Block a user