-
-
Notifications
You must be signed in to change notification settings - Fork 32
All Feature's using Feature Flag Hook #324
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
base: dev
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ import { VisibleWithDelay } from '../../common-components/visible'; | |
|
||
import './block-panel-generic.css'; | ||
import { localise } from '../../localisation'; | ||
import { useFeatureFlag } from '../../api/featureFlags'; | ||
|
||
/** @typedef {import('@tanstack/react-query').InfiniteData<{ blocklist: (BlockedByRecord | { did: string; blocked_date: string })[]; count?: number }>} InfBlockData */ | ||
|
||
|
@@ -41,6 +42,8 @@ export function BlockPanelGeneric({ | |
const blocklistPages = data?.pages || []; | ||
const blocklist = blocklistPages.flatMap((page) => page.blocklist); | ||
const count = totalData?.count; | ||
const pageName = (className == 'blocked-by-panel') ? 'blocked-by-count' : 'blocking-count'; | ||
const pageCount = useFeatureFlag(pageName) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. likewise, this needs to disable the queries, but those are made elsewhere and passed by props, so this hook needs to be called elsewhere too |
||
|
||
// const [searchParams, setSearchParams] = useSearchParams(); | ||
// const [tick, setTick] = useState(0); | ||
|
@@ -74,6 +77,7 @@ export function BlockPanelGeneric({ | |
header={header} | ||
// Ironically this hides the search button | ||
showSearch={true} | ||
pagecount={pageCount} | ||
// setShowSearch={setShowSearch} | ||
// onShowSearch={() => setShowSearch(true)} | ||
// onToggleView={() => setTableView(!tableView)} | ||
|
@@ -118,7 +122,8 @@ class PanelHeader extends React.Component { | |
count = this.state?.count || 0; | ||
} | ||
|
||
const { blocklist, header } = this.props; | ||
const { blocklist, header, pagecount } = this.props; | ||
|
||
|
||
return ( | ||
<h3 | ||
|
@@ -129,7 +134,7 @@ class PanelHeader extends React.Component { | |
: ' blocking-panel-header-loading') | ||
} | ||
> | ||
{typeof header === 'function' ? header({ count, blocklist }) : header} | ||
{pagecount && (typeof header === 'function' ? header({ count, blocklist }) : header)} | ||
|
||
<span className="panel-toggles"> | ||
{this.props.showSearch ? undefined : ( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ import { SearchHeaderDebounced } from '../history/search-header'; | |
import { VisibleWithDelay } from '../../common-components/visible'; | ||
import { resolveHandleOrDID } from '../../api'; | ||
import { useAccountResolver } from '../account-resolver'; | ||
import { useFeatureFlag } from '../../api/featureFlags'; | ||
|
||
export function BlockedByLists() { | ||
const accountQuery = useAccountResolver(); | ||
|
@@ -30,6 +31,7 @@ export function BlockedByLists() { | |
const listPages = data?.pages || []; | ||
const allLists = listPages.flatMap((page) => page.blocklist); | ||
const filteredLists = !search ? allLists : matchSearch(allLists, search, () => setTick(tick + 1)); | ||
const listsBlockedByCount = useFeatureFlag('lists-blocked-by-count') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here as well. should be controlling whether a query is made |
||
|
||
// Show loader for initial load | ||
if (isLoading) { | ||
|
@@ -55,7 +57,7 @@ export function BlockedByLists() { | |
</div> | ||
</div> | ||
|
||
<h3 className='lists-header'> | ||
{listsBlockedByCount && (<h3 className='lists-header'> | ||
{(isLoadingTotal && !listsTotal) && <span style={{ opacity: 0.5 }}>{"Counting block lists..."}</span>} | ||
{listsTotal ? | ||
<> | ||
|
@@ -72,7 +74,7 @@ export function BlockedByLists() { | |
</> : | ||
isLoadingTotal ? null : 'Not blocked by any users via lists' | ||
} | ||
</h3> | ||
</h3>)} | ||
|
||
<BlockListsView | ||
list={filteredLists} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ import { SearchHeaderDebounced } from '../history/search-header'; | |
import { VisibleWithDelay } from '../../common-components/visible'; | ||
import { resolveHandleOrDID } from '../../api'; | ||
import { useAccountResolver } from '../account-resolver'; | ||
import { useFeatureFlag } from '../../api/featureFlags'; | ||
|
||
export function BlockingLists() { | ||
const accountQuery = useAccountResolver(); | ||
|
@@ -30,7 +31,7 @@ export function BlockingLists() { | |
const listPages = data?.pages || []; | ||
const allLists = listPages.flatMap((page) => page.blocklist); | ||
const filteredLists = !search ? allLists : matchSearch(allLists, search, () => setTick(tick + 1)); | ||
|
||
const listsBlockingCount = useFeatureFlag('lists-blocking-count') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also here |
||
// Show loader for initial load | ||
if (isLoading) { | ||
return ( | ||
|
@@ -55,7 +56,7 @@ export function BlockingLists() { | |
</div> | ||
</div> | ||
|
||
<h3 className='lists-header'> | ||
{listsBlockingCount && (<h3 className='lists-header'> | ||
{(isLoadingTotal && !listTotalBlocks) && <span style={{ opacity: 0.5 }}>{"Counting lists..."}</span>} | ||
{listTotalBlocks ? | ||
<> | ||
|
@@ -72,7 +73,7 @@ export function BlockingLists() { | |
</> : | ||
isLoadingTotal ? null : 'Not blocking any users via lists' | ||
} | ||
</h3> | ||
</h3>)} | ||
|
||
<BlockListsView | ||
list={filteredLists} /> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ import { AccountShortEntry } from '../../common-components/account-short-entry'; | |
import { FormatTimestamp } from '../../common-components/format-timestamp'; | ||
import { useAccountResolver } from '../account-resolver'; | ||
import './labeled.css'; | ||
import { useFeatureFlag } from '../../api/featureFlags'; | ||
|
||
/** | ||
* @param {{ | ||
|
@@ -96,6 +97,7 @@ export default function LabeledPanel() { | |
const { data: labelers, isLoading: isLoadingLabelers } = useLabelers(); | ||
|
||
const { data: labels, isLoading } = useLabeled(did, labelers); | ||
const labelsCount = useFeatureFlag('labels-count') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this this is one last api call that wasn't addressed in the last round of changes |
||
|
||
return ( | ||
<div | ||
|
@@ -106,7 +108,7 @@ export default function LabeledPanel() { | |
minHeight: '100%', | ||
}} | ||
> | ||
<h3 className="labeled-header">Labeled {labels?.length} Times</h3> | ||
{labelsCount && (<h3 className="labeled-header">Labeled {labels?.length} Times</h3>)} | ||
|
||
{isLoadingLabelers || isLoading ? ( | ||
<div>Loading...</div> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ import { localise, localiseNumberSuffix } from '../../localisation'; | |
import { useAccountResolver } from '../account-resolver'; | ||
import { SearchHeaderDebounced } from '../history/search-header'; | ||
import './lists.css'; | ||
import { useFeatureFlag } from '../../api/featureFlags'; | ||
|
||
export function Lists() { | ||
|
||
|
@@ -29,6 +30,7 @@ export function Lists() { | |
const [tick, setTick] = useState(0); | ||
const search = (searchParams.get('q') || '').trim(); | ||
const [showSearch, setShowSearch] = useState(!!search); | ||
const listsOnListCounts = useFeatureFlag('lists-on-list-counts') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
|
||
const listsTotal = totalData?.count; | ||
const listPages = data?.pages || []; | ||
|
@@ -69,7 +71,7 @@ export function Lists() { | |
{localise('Counting lists...', {})} | ||
</span> | ||
)} | ||
{listsTotal ? ( | ||
{listsOnListCounts && listsTotal ? ( | ||
<> | ||
{localise( | ||
'Member of ' + | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ import { VisibleWithDelay } from '../../common-components/visible'; | |
import { localise, localiseNumberSuffix } from '../../localisation'; | ||
import { useAccountResolver } from '../account-resolver'; | ||
import { SearchHeaderDebounced } from '../history/search-header'; | ||
import { useFeatureFlag } from '../../api/featureFlags'; | ||
|
||
export default function Packed() { | ||
// STARTER PACKS CONTAINING USERS | ||
|
@@ -30,6 +31,7 @@ export default function Packed() { | |
const search = (searchParams.get('q') || '').trim(); | ||
const [tick, setTick] = useState(0); | ||
const [showSearch, setShowSearch] = useState(!!search); | ||
const starterPacksInCount = useFeatureFlag('starter-packs-in-count'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and again here |
||
|
||
const packsTotal = totalData?.count; | ||
const Packlist = data?.pages || []; | ||
|
@@ -70,11 +72,11 @@ export default function Packed() { | |
|
||
{packsTotal ? ( | ||
<> | ||
{'Member of ' + | ||
{starterPacksInCount && ('Member of ' + | ||
packsTotal.toLocaleString() + | ||
' ' + | ||
localiseNumberSuffix('pack', packsTotal) + | ||
':'} | ||
':')} | ||
<span className="panel-toggles"> | ||
{!showSearch && ( | ||
<Button | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ import { VisibleWithDelay } from '../../common-components/visible'; | |
import { localise, localiseNumberSuffix } from '../../localisation'; | ||
import { useAccountResolver } from '../account-resolver'; | ||
import { SearchHeaderDebounced } from '../history/search-header'; | ||
import { useFeatureFlag } from '../../api/featureFlags'; | ||
|
||
export function Packs({ created = false }) { | ||
// STARTER PACKS CREATED | ||
|
@@ -30,6 +31,7 @@ export function Packs({ created = false }) { | |
const [tick, setTick] = useState(0); | ||
const search = (searchParams.get('q') || '').trim(); | ||
const [showSearch, setShowSearch] = useState(!!search); | ||
const starterPacksMadeCount = useFeatureFlag('starter-packs-made-count'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and here |
||
|
||
const packsTotal = totalData?.count; | ||
const Packlist = data?.pages || []; | ||
|
@@ -70,7 +72,7 @@ export function Packs({ created = false }) { | |
)} | ||
{packsTotal ? ( | ||
<> | ||
{localise( | ||
{starterPacksMadeCount && (localise( | ||
'Creator of ' + | ||
packsTotal.toLocaleString() + | ||
' ' + | ||
|
@@ -79,7 +81,7 @@ export function Packs({ created = false }) { | |
{ | ||
// todo : add language map | ||
} | ||
)} | ||
))} | ||
<span className="panel-toggles"> | ||
{!showSearch && ( | ||
<Button | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the placement flag needs to conditionally disable this query rather than just hiding the ui it displays in