|
|
@ -5,11 +5,13 @@ import { useEffect, useMemo, useState } from 'react';
|
|
|
|
import { Bars3BottomLeftIcon } from '@heroicons/react/20/solid';
|
|
|
|
import { Bars3BottomLeftIcon } from '@heroicons/react/20/solid';
|
|
|
|
import { NoSymbolIcon } from '@heroicons/react/24/outline';
|
|
|
|
import { NoSymbolIcon } from '@heroicons/react/24/outline';
|
|
|
|
import type { QuestionsQuestionType } from '@prisma/client';
|
|
|
|
import type { QuestionsQuestionType } from '@prisma/client';
|
|
|
|
|
|
|
|
import type { TypeaheadOption } from '@tih/ui';
|
|
|
|
import { Button, SlideOut } from '@tih/ui';
|
|
|
|
import { Button, SlideOut } from '@tih/ui';
|
|
|
|
|
|
|
|
|
|
|
|
import QuestionOverviewCard from '~/components/questions/card/question/QuestionOverviewCard';
|
|
|
|
import QuestionOverviewCard from '~/components/questions/card/question/QuestionOverviewCard';
|
|
|
|
import ContributeQuestionCard from '~/components/questions/ContributeQuestionCard';
|
|
|
|
import ContributeQuestionCard from '~/components/questions/ContributeQuestionCard';
|
|
|
|
import FilterSection from '~/components/questions/filter/FilterSection';
|
|
|
|
import FilterSection from '~/components/questions/filter/FilterSection';
|
|
|
|
|
|
|
|
import PaginationLoadMoreButton from '~/components/questions/PaginationLoadMoreButton';
|
|
|
|
import QuestionSearchBar from '~/components/questions/QuestionSearchBar';
|
|
|
|
import QuestionSearchBar from '~/components/questions/QuestionSearchBar';
|
|
|
|
import CompanyTypeahead from '~/components/questions/typeahead/CompanyTypeahead';
|
|
|
|
import CompanyTypeahead from '~/components/questions/typeahead/CompanyTypeahead';
|
|
|
|
import LocationTypeahead from '~/components/questions/typeahead/LocationTypeahead';
|
|
|
|
import LocationTypeahead from '~/components/questions/typeahead/LocationTypeahead';
|
|
|
@ -17,8 +19,6 @@ import RoleTypeahead from '~/components/questions/typeahead/RoleTypeahead';
|
|
|
|
import { JobTitleLabels } from '~/components/shared/JobTitles';
|
|
|
|
import { JobTitleLabels } from '~/components/shared/JobTitles';
|
|
|
|
|
|
|
|
|
|
|
|
import type { QuestionAge } from '~/utils/questions/constants';
|
|
|
|
import type { QuestionAge } from '~/utils/questions/constants';
|
|
|
|
import { SORT_TYPES } from '~/utils/questions/constants';
|
|
|
|
|
|
|
|
import { SORT_ORDERS } from '~/utils/questions/constants';
|
|
|
|
|
|
|
|
import { APP_TITLE } from '~/utils/questions/constants';
|
|
|
|
import { APP_TITLE } from '~/utils/questions/constants';
|
|
|
|
import { QUESTION_AGES, QUESTION_TYPES } from '~/utils/questions/constants';
|
|
|
|
import { QUESTION_AGES, QUESTION_TYPES } from '~/utils/questions/constants';
|
|
|
|
import createSlug from '~/utils/questions/createSlug';
|
|
|
|
import createSlug from '~/utils/questions/createSlug';
|
|
|
@ -29,14 +29,29 @@ import {
|
|
|
|
} from '~/utils/questions/useSearchParam';
|
|
|
|
} from '~/utils/questions/useSearchParam';
|
|
|
|
import { trpc } from '~/utils/trpc';
|
|
|
|
import { trpc } from '~/utils/trpc';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import type { Location } from '~/types/questions.d';
|
|
|
|
import { SortType } from '~/types/questions.d';
|
|
|
|
import { SortType } from '~/types/questions.d';
|
|
|
|
import { SortOrder } from '~/types/questions.d';
|
|
|
|
import { SortOrder } from '~/types/questions.d';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function locationToSlug(value: Location & TypeaheadOption): string {
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
|
|
|
value.countryId,
|
|
|
|
|
|
|
|
value.stateId,
|
|
|
|
|
|
|
|
value.cityId,
|
|
|
|
|
|
|
|
value.id,
|
|
|
|
|
|
|
|
value.label,
|
|
|
|
|
|
|
|
value.value,
|
|
|
|
|
|
|
|
].join('-');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default function QuestionsBrowsePage() {
|
|
|
|
export default function QuestionsBrowsePage() {
|
|
|
|
const router = useRouter();
|
|
|
|
const router = useRouter();
|
|
|
|
|
|
|
|
|
|
|
|
const [selectedCompanies, setSelectedCompanies, areCompaniesInitialized] =
|
|
|
|
const [
|
|
|
|
useSearchParam('companies');
|
|
|
|
selectedCompanySlugs,
|
|
|
|
|
|
|
|
setSelectedCompanySlugs,
|
|
|
|
|
|
|
|
areCompaniesInitialized,
|
|
|
|
|
|
|
|
] = useSearchParam('companies');
|
|
|
|
const [
|
|
|
|
const [
|
|
|
|
selectedQuestionTypes,
|
|
|
|
selectedQuestionTypes,
|
|
|
|
setSelectedQuestionTypes,
|
|
|
|
setSelectedQuestionTypes,
|
|
|
@ -70,7 +85,13 @@ export default function QuestionsBrowsePage() {
|
|
|
|
const [selectedRoles, setSelectedRoles, areRolesInitialized] =
|
|
|
|
const [selectedRoles, setSelectedRoles, areRolesInitialized] =
|
|
|
|
useSearchParam('roles');
|
|
|
|
useSearchParam('roles');
|
|
|
|
const [selectedLocations, setSelectedLocations, areLocationsInitialized] =
|
|
|
|
const [selectedLocations, setSelectedLocations, areLocationsInitialized] =
|
|
|
|
useSearchParam('locations');
|
|
|
|
useSearchParam<Location & TypeaheadOption>('locations', {
|
|
|
|
|
|
|
|
paramToString: locationToSlug,
|
|
|
|
|
|
|
|
stringToParam: (param) => {
|
|
|
|
|
|
|
|
const [countryId, stateId, cityId, id, label, value] = param.split('-');
|
|
|
|
|
|
|
|
return { cityId, countryId, id, label, stateId, value };
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const [sortOrder, setSortOrder, isSortOrderInitialized] =
|
|
|
|
const [sortOrder, setSortOrder, isSortOrderInitialized] =
|
|
|
|
useSearchParamSingle<SortOrder>('sortOrder', {
|
|
|
|
useSearchParamSingle<SortOrder>('sortOrder', {
|
|
|
@ -122,13 +143,13 @@ export default function QuestionsBrowsePage() {
|
|
|
|
|
|
|
|
|
|
|
|
const hasFilters = useMemo(
|
|
|
|
const hasFilters = useMemo(
|
|
|
|
() =>
|
|
|
|
() =>
|
|
|
|
selectedCompanies.length > 0 ||
|
|
|
|
selectedCompanySlugs.length > 0 ||
|
|
|
|
selectedQuestionTypes.length > 0 ||
|
|
|
|
selectedQuestionTypes.length > 0 ||
|
|
|
|
selectedQuestionAge !== 'all' ||
|
|
|
|
selectedQuestionAge !== 'all' ||
|
|
|
|
selectedRoles.length > 0 ||
|
|
|
|
selectedRoles.length > 0 ||
|
|
|
|
selectedLocations.length > 0,
|
|
|
|
selectedLocations.length > 0,
|
|
|
|
[
|
|
|
|
[
|
|
|
|
selectedCompanies,
|
|
|
|
selectedCompanySlugs,
|
|
|
|
selectedQuestionTypes,
|
|
|
|
selectedQuestionTypes,
|
|
|
|
selectedQuestionAge,
|
|
|
|
selectedQuestionAge,
|
|
|
|
selectedRoles,
|
|
|
|
selectedRoles,
|
|
|
@ -147,24 +168,24 @@ export default function QuestionsBrowsePage() {
|
|
|
|
: undefined;
|
|
|
|
: undefined;
|
|
|
|
}, [selectedQuestionAge]);
|
|
|
|
}, [selectedQuestionAge]);
|
|
|
|
|
|
|
|
|
|
|
|
const {
|
|
|
|
const questionsInfiniteQuery = trpc.useInfiniteQuery(
|
|
|
|
data: questionsQueryData,
|
|
|
|
|
|
|
|
fetchNextPage,
|
|
|
|
|
|
|
|
hasNextPage,
|
|
|
|
|
|
|
|
isFetchingNextPage,
|
|
|
|
|
|
|
|
} = trpc.useInfiniteQuery(
|
|
|
|
|
|
|
|
[
|
|
|
|
[
|
|
|
|
'questions.questions.getQuestionsByFilter',
|
|
|
|
'questions.questions.getQuestionsByFilter',
|
|
|
|
{
|
|
|
|
{
|
|
|
|
companyNames: selectedCompanies,
|
|
|
|
// TODO: Enable filtering by countryIds and stateIds
|
|
|
|
|
|
|
|
cityIds: selectedLocations
|
|
|
|
|
|
|
|
.map(({ cityId }) => cityId)
|
|
|
|
|
|
|
|
.filter((id) => id !== undefined) as Array<string>,
|
|
|
|
|
|
|
|
companyIds: selectedCompanySlugs.map((slug) => slug.split('_')[0]),
|
|
|
|
|
|
|
|
countryIds: [],
|
|
|
|
endDate: today,
|
|
|
|
endDate: today,
|
|
|
|
limit: 10,
|
|
|
|
limit: 10,
|
|
|
|
locations: selectedLocations,
|
|
|
|
|
|
|
|
questionTypes: selectedQuestionTypes,
|
|
|
|
questionTypes: selectedQuestionTypes,
|
|
|
|
roles: selectedRoles,
|
|
|
|
roles: selectedRoles,
|
|
|
|
sortOrder,
|
|
|
|
sortOrder,
|
|
|
|
sortType,
|
|
|
|
sortType,
|
|
|
|
startDate,
|
|
|
|
startDate,
|
|
|
|
|
|
|
|
stateIds: [],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -173,6 +194,8 @@ export default function QuestionsBrowsePage() {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { data: questionsQueryData } = questionsInfiniteQuery;
|
|
|
|
|
|
|
|
|
|
|
|
const questionCount = useMemo(() => {
|
|
|
|
const questionCount = useMemo(() => {
|
|
|
|
if (!questionsQueryData) {
|
|
|
|
if (!questionsQueryData) {
|
|
|
|
return undefined;
|
|
|
|
return undefined;
|
|
|
@ -239,8 +262,8 @@ export default function QuestionsBrowsePage() {
|
|
|
|
Router.replace({
|
|
|
|
Router.replace({
|
|
|
|
pathname,
|
|
|
|
pathname,
|
|
|
|
query: {
|
|
|
|
query: {
|
|
|
|
companies: selectedCompanies,
|
|
|
|
companies: selectedCompanySlugs,
|
|
|
|
locations: selectedLocations,
|
|
|
|
locations: selectedLocations.map(locationToSlug),
|
|
|
|
questionAge: selectedQuestionAge,
|
|
|
|
questionAge: selectedQuestionAge,
|
|
|
|
questionTypes: selectedQuestionTypes,
|
|
|
|
questionTypes: selectedQuestionTypes,
|
|
|
|
roles: selectedRoles,
|
|
|
|
roles: selectedRoles,
|
|
|
@ -255,7 +278,7 @@ export default function QuestionsBrowsePage() {
|
|
|
|
areSearchOptionsInitialized,
|
|
|
|
areSearchOptionsInitialized,
|
|
|
|
loaded,
|
|
|
|
loaded,
|
|
|
|
pathname,
|
|
|
|
pathname,
|
|
|
|
selectedCompanies,
|
|
|
|
selectedCompanySlugs,
|
|
|
|
selectedRoles,
|
|
|
|
selectedRoles,
|
|
|
|
selectedLocations,
|
|
|
|
selectedLocations,
|
|
|
|
selectedQuestionAge,
|
|
|
|
selectedQuestionAge,
|
|
|
@ -265,13 +288,16 @@ export default function QuestionsBrowsePage() {
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
const selectedCompanyOptions = useMemo(() => {
|
|
|
|
const selectedCompanyOptions = useMemo(() => {
|
|
|
|
return selectedCompanies.map((company) => ({
|
|
|
|
return selectedCompanySlugs.map((company) => {
|
|
|
|
checked: true,
|
|
|
|
const [id, label] = company.split('_');
|
|
|
|
id: company,
|
|
|
|
return {
|
|
|
|
label: company,
|
|
|
|
checked: true,
|
|
|
|
value: company,
|
|
|
|
id,
|
|
|
|
}));
|
|
|
|
label,
|
|
|
|
}, [selectedCompanies]);
|
|
|
|
value: id,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}, [selectedCompanySlugs]);
|
|
|
|
|
|
|
|
|
|
|
|
const selectedRoleOptions = useMemo(() => {
|
|
|
|
const selectedRoleOptions = useMemo(() => {
|
|
|
|
return selectedRoles.map((role) => ({
|
|
|
|
return selectedRoles.map((role) => ({
|
|
|
@ -285,9 +311,7 @@ export default function QuestionsBrowsePage() {
|
|
|
|
const selectedLocationOptions = useMemo(() => {
|
|
|
|
const selectedLocationOptions = useMemo(() => {
|
|
|
|
return selectedLocations.map((location) => ({
|
|
|
|
return selectedLocations.map((location) => ({
|
|
|
|
checked: true,
|
|
|
|
checked: true,
|
|
|
|
id: location,
|
|
|
|
...location,
|
|
|
|
label: location,
|
|
|
|
|
|
|
|
value: location,
|
|
|
|
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
}, [selectedLocations]);
|
|
|
|
}, [selectedLocations]);
|
|
|
|
|
|
|
|
|
|
|
@ -305,7 +329,7 @@ export default function QuestionsBrowsePage() {
|
|
|
|
label="Clear filters"
|
|
|
|
label="Clear filters"
|
|
|
|
variant="tertiary"
|
|
|
|
variant="tertiary"
|
|
|
|
onClick={() => {
|
|
|
|
onClick={() => {
|
|
|
|
setSelectedCompanies([]);
|
|
|
|
setSelectedCompanySlugs([]);
|
|
|
|
setSelectedQuestionTypes([]);
|
|
|
|
setSelectedQuestionTypes([]);
|
|
|
|
setSelectedQuestionAge('all');
|
|
|
|
setSelectedQuestionAge('all');
|
|
|
|
setSelectedRoles([]);
|
|
|
|
setSelectedRoles([]);
|
|
|
@ -320,8 +344,8 @@ export default function QuestionsBrowsePage() {
|
|
|
|
{...field}
|
|
|
|
{...field}
|
|
|
|
clearOnSelect={true}
|
|
|
|
clearOnSelect={true}
|
|
|
|
filterOption={(option) => {
|
|
|
|
filterOption={(option) => {
|
|
|
|
return !selectedCompanies.some((company) => {
|
|
|
|
return !selectedCompanySlugs.some((companySlug) => {
|
|
|
|
return company === option.value;
|
|
|
|
return companySlug === `${option.id}_${option.label}`;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
isLabelHidden={true}
|
|
|
|
isLabelHidden={true}
|
|
|
@ -337,10 +361,15 @@ export default function QuestionsBrowsePage() {
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
onOptionChange={(option) => {
|
|
|
|
onOptionChange={(option) => {
|
|
|
|
if (option.checked) {
|
|
|
|
if (option.checked) {
|
|
|
|
setSelectedCompanies([...selectedCompanies, option.label]);
|
|
|
|
setSelectedCompanySlugs([
|
|
|
|
|
|
|
|
...selectedCompanySlugs,
|
|
|
|
|
|
|
|
`${option.id}_${option.label}`,
|
|
|
|
|
|
|
|
]);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
setSelectedCompanies(
|
|
|
|
setSelectedCompanySlugs(
|
|
|
|
selectedCompanies.filter((company) => company !== option.label),
|
|
|
|
selectedCompanySlugs.filter(
|
|
|
|
|
|
|
|
(companySlug) => companySlug !== `${option.id}_${option.label}`,
|
|
|
|
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
}}
|
|
|
@ -348,7 +377,10 @@ export default function QuestionsBrowsePage() {
|
|
|
|
<FilterSection
|
|
|
|
<FilterSection
|
|
|
|
label="Roles"
|
|
|
|
label="Roles"
|
|
|
|
options={selectedRoleOptions}
|
|
|
|
options={selectedRoleOptions}
|
|
|
|
renderInput={({ onOptionChange, field: { ref: _, ...field } }) => (
|
|
|
|
renderInput={({
|
|
|
|
|
|
|
|
onOptionChange,
|
|
|
|
|
|
|
|
field: { ref: _, onChange: __, ...field },
|
|
|
|
|
|
|
|
}) => (
|
|
|
|
<RoleTypeahead
|
|
|
|
<RoleTypeahead
|
|
|
|
{...field}
|
|
|
|
{...field}
|
|
|
|
clearOnSelect={true}
|
|
|
|
clearOnSelect={true}
|
|
|
@ -406,13 +438,16 @@ export default function QuestionsBrowsePage() {
|
|
|
|
<FilterSection
|
|
|
|
<FilterSection
|
|
|
|
label="Locations"
|
|
|
|
label="Locations"
|
|
|
|
options={selectedLocationOptions}
|
|
|
|
options={selectedLocationOptions}
|
|
|
|
renderInput={({ onOptionChange, field: { ref: _, ...field } }) => (
|
|
|
|
renderInput={({
|
|
|
|
|
|
|
|
onOptionChange,
|
|
|
|
|
|
|
|
field: { ref: _, onChange: __, ...field },
|
|
|
|
|
|
|
|
}) => (
|
|
|
|
<LocationTypeahead
|
|
|
|
<LocationTypeahead
|
|
|
|
{...field}
|
|
|
|
{...field}
|
|
|
|
clearOnSelect={true}
|
|
|
|
clearOnSelect={true}
|
|
|
|
filterOption={(option) => {
|
|
|
|
filterOption={(option) => {
|
|
|
|
return !selectedLocations.some((location) => {
|
|
|
|
return !selectedLocations.some((location) => {
|
|
|
|
return location === option.value;
|
|
|
|
return location.id === option.id;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
isLabelHidden={true}
|
|
|
|
isLabelHidden={true}
|
|
|
@ -428,10 +463,14 @@ export default function QuestionsBrowsePage() {
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
onOptionChange={(option) => {
|
|
|
|
onOptionChange={(option) => {
|
|
|
|
if (option.checked) {
|
|
|
|
if (option.checked) {
|
|
|
|
setSelectedLocations([...selectedLocations, option.value]);
|
|
|
|
// TODO: Fix type inference, then remove the `as` cast.
|
|
|
|
|
|
|
|
setSelectedLocations([
|
|
|
|
|
|
|
|
...selectedLocations,
|
|
|
|
|
|
|
|
option as unknown as Location & TypeaheadOption,
|
|
|
|
|
|
|
|
]);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
setSelectedLocations(
|
|
|
|
setSelectedLocations(
|
|
|
|
selectedLocations.filter((role) => role !== option.value),
|
|
|
|
selectedLocations.filter((location) => location.id !== option.id),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
}}
|
|
|
@ -450,21 +489,22 @@ export default function QuestionsBrowsePage() {
|
|
|
|
<div className="m-4 flex max-w-3xl flex-1 flex-col items-stretch justify-start gap-8">
|
|
|
|
<div className="m-4 flex max-w-3xl flex-1 flex-col items-stretch justify-start gap-8">
|
|
|
|
<ContributeQuestionCard
|
|
|
|
<ContributeQuestionCard
|
|
|
|
onSubmit={(data) => {
|
|
|
|
onSubmit={(data) => {
|
|
|
|
|
|
|
|
const { cityId, countryId, stateId } = data.location;
|
|
|
|
createQuestion({
|
|
|
|
createQuestion({
|
|
|
|
|
|
|
|
cityId,
|
|
|
|
companyId: data.company,
|
|
|
|
companyId: data.company,
|
|
|
|
content: data.questionContent,
|
|
|
|
content: data.questionContent,
|
|
|
|
location: data.location,
|
|
|
|
countryId,
|
|
|
|
questionType: data.questionType,
|
|
|
|
questionType: data.questionType,
|
|
|
|
role: data.role,
|
|
|
|
role: data.role.value,
|
|
|
|
seenAt: data.date,
|
|
|
|
seenAt: data.date,
|
|
|
|
|
|
|
|
stateId,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<div className="sticky top-0 border-b border-slate-300 bg-slate-50 py-4">
|
|
|
|
<div className="sticky top-0 border-b border-slate-300 bg-slate-50 py-4">
|
|
|
|
<QuestionSearchBar
|
|
|
|
<QuestionSearchBar
|
|
|
|
sortOrderOptions={SORT_ORDERS}
|
|
|
|
|
|
|
|
sortOrderValue={sortOrder}
|
|
|
|
sortOrderValue={sortOrder}
|
|
|
|
sortTypeOptions={SORT_TYPES}
|
|
|
|
|
|
|
|
sortTypeValue={sortType}
|
|
|
|
sortTypeValue={sortType}
|
|
|
|
onFilterOptionsToggle={() => {
|
|
|
|
onFilterOptionsToggle={() => {
|
|
|
|
setFilterDrawerOpen(!filterDrawerOpen);
|
|
|
|
setFilterDrawerOpen(!filterDrawerOpen);
|
|
|
@ -477,7 +517,7 @@ export default function QuestionsBrowsePage() {
|
|
|
|
{(questionsQueryData?.pages ?? []).flatMap(
|
|
|
|
{(questionsQueryData?.pages ?? []).flatMap(
|
|
|
|
({ data: questions }) =>
|
|
|
|
({ data: questions }) =>
|
|
|
|
questions.map((question) => {
|
|
|
|
questions.map((question) => {
|
|
|
|
const { companyCounts, locationCounts, roleCounts } =
|
|
|
|
const { companyCounts, countryCounts, roleCounts } =
|
|
|
|
relabelQuestionAggregates(
|
|
|
|
relabelQuestionAggregates(
|
|
|
|
question.aggregatedQuestionEncounters,
|
|
|
|
question.aggregatedQuestionEncounters,
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -488,10 +528,10 @@ export default function QuestionsBrowsePage() {
|
|
|
|
answerCount={question.numAnswers}
|
|
|
|
answerCount={question.numAnswers}
|
|
|
|
companies={companyCounts}
|
|
|
|
companies={companyCounts}
|
|
|
|
content={question.content}
|
|
|
|
content={question.content}
|
|
|
|
|
|
|
|
countries={countryCounts}
|
|
|
|
href={`/questions/${question.id}/${createSlug(
|
|
|
|
href={`/questions/${question.id}/${createSlug(
|
|
|
|
question.content,
|
|
|
|
question.content,
|
|
|
|
)}`}
|
|
|
|
)}`}
|
|
|
|
locations={locationCounts}
|
|
|
|
|
|
|
|
questionId={question.id}
|
|
|
|
questionId={question.id}
|
|
|
|
receivedCount={question.receivedCount}
|
|
|
|
receivedCount={question.receivedCount}
|
|
|
|
roles={roleCounts}
|
|
|
|
roles={roleCounts}
|
|
|
@ -508,15 +548,7 @@ export default function QuestionsBrowsePage() {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
<Button
|
|
|
|
<PaginationLoadMoreButton query={questionsInfiniteQuery} />
|
|
|
|
disabled={!hasNextPage || isFetchingNextPage}
|
|
|
|
|
|
|
|
isLoading={isFetchingNextPage}
|
|
|
|
|
|
|
|
label={hasNextPage ? 'Load more' : 'Nothing more to load'}
|
|
|
|
|
|
|
|
variant="tertiary"
|
|
|
|
|
|
|
|
onClick={() => {
|
|
|
|
|
|
|
|
fetchNextPage();
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
{questionCount === 0 && (
|
|
|
|
{questionCount === 0 && (
|
|
|
|
<div className="flex w-full items-center justify-center gap-2 rounded-md border border-slate-300 bg-slate-200 p-4 text-slate-600">
|
|
|
|
<div className="flex w-full items-center justify-center gap-2 rounded-md border border-slate-300 bg-slate-200 p-4 text-slate-600">
|
|
|
|
<NoSymbolIcon className="h-6 w-6" />
|
|
|
|
<NoSymbolIcon className="h-6 w-6" />
|
|
|
|