Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ✨ add config to hide moderation #393

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/components/feed-item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ const TokenHover = ({ nft, visible }: { nft: NFT; visible: boolean }) => {
}

export const FeedItem = ({ nft }: { nft: NFT }) => {
const [nsfwFriendly, photosensitiveFriendly] = useLocalSettings(
(state) => [state.nsfwFriendly, state.photosensitiveFriendly],
const [nsfwFriendly, photosensitiveFriendly, skipModeration] = useLocalSettings(
(state) => [state.nsfwFriendly, state.photosensitiveFriendly, state.has_seen_moderation],
shallow
)
const zen = useLocalSettings((st) => st.zen)
Expand All @@ -70,7 +70,7 @@ export const FeedItem = ({ nft }: { nft: NFT }) => {
// onMouseLeave={() => setHover(false)}
className={containerClasses}
>
{nft.isModerated && (
{nft.isModerated && !skipModeration && (
<div className={styles.moderation_corner}>
<span>MODERATED</span>
</div>
Expand Down
4 changes: 4 additions & 0 deletions src/context/localSettingsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export type RPC_NODES = (typeof rpc_nodes)[number]
interface LocalSettingsState {
applyTheme: (theme: Theme) => void
has_seen_banner: boolean
has_seen_moderation: boolean
nsfwFriendly: boolean
photosensitiveFriendly: boolean
startFeed: FeedType
Expand All @@ -46,6 +47,7 @@ interface LocalSettingsState {
setImgproxy: (imgproxy: boolean) => void
setViewMode: (mode: ViewMode) => void
setHasSeenBanner: (seen: boolean) => void
setHasSeenModeration: (seen: boolean) => void
setZen: (zen: boolean) => void
theme: Theme
themeDark: Theme
Expand Down Expand Up @@ -73,6 +75,7 @@ const defaultValues = {
tilted: false,
imgproxy: true,
has_seen_banner: false,
has_seen_moderation: false,
}
// TODO: replace all the "set" methods with one that merges the state with the provided partial object
export const useLocalSettings = create<LocalSettingsState>()(
Expand All @@ -81,6 +84,7 @@ export const useLocalSettings = create<LocalSettingsState>()(
(set, get) => ({
...defaultValues,
setHasSeenBanner: (has_seen_banner) => set({ has_seen_banner }),
setHasSeenModeration: (has_seen_moderation) => set({ has_seen_moderation }),
setTilted: (tilted) => set({ tilted }),
setImgproxy: (imgproxy) => set({ imgproxy }),
toggleViewMode: () =>
Expand Down
15 changes: 15 additions & 0 deletions src/pages/config/Settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export const Settings = () => {
setImgproxy,
has_seen_banner,
setHasSeenBanner,
has_seen_moderation,
setHasSeenModeration,
] = useLocalSettings((st) => [
st.nsfwFriendly,
st.setNsfwFriendly,
Expand All @@ -61,6 +63,8 @@ export const Settings = () => {
st.setImgproxy,
st.has_seen_banner,
st.setHasSeenBanner,
st.has_seen_moderation,
st.setHasSeenModeration,
])

return (
Expand Down Expand Up @@ -170,6 +174,17 @@ export const Settings = () => {
label={'Hide banner for last announcement'}
/>
)}
<Checkbox
alt={`click to ${
setHasSeenModeration ? 'disable' : 'enable'
} the teia moderation symbol over you own tokens`}
title={`click to ${
setHasSeenModeration ? 'disable' : 'enable'
} the teia moderation symbol over you own tokens`}
checked={has_seen_moderation}
onCheck={setHasSeenModeration}
label={'Hide the moderation ribbon'}
/>
</div>
</div>
</Page>
Expand Down
Loading