fix "other" option, add Ids for posthog

This commit is contained in:
Johannes
2023-05-04 08:54:38 +02:00
parent ea084c3075
commit d2c837b54f
3 changed files with 13 additions and 9 deletions

View File

@@ -25,7 +25,7 @@ export default function TemplateList({ environmentId, onTemplateClick }: Templat
const { product, isLoadingProduct, isErrorProduct } = useProduct(environmentId);
const { profile, isLoadingProfile, isErrorProfile } = useProfile();
const [selectedFilter, setSelectedFilter] = useState(ALL_CATEGORY_NAME);
const [selectedFilter, setSelectedFilter] = useState(RECOMMENDED_CATEGORY_NAME);
const [categories, setCategories] = useState<Array<string>>([]);
@@ -41,13 +41,15 @@ export default function TemplateList({ environmentId, onTemplateClick }: Templat
...(Array.from(new Set(templates.map((template) => template.category))) as string[]),
];
const fullCategories = !!profile?.objective
? [RECOMMENDED_CATEGORY_NAME, ...defaultCategories]
: defaultCategories;
const fullCategories =
!!profile?.objective && profile.objective !== "other"
? [RECOMMENDED_CATEGORY_NAME, ...defaultCategories]
: [ALL_CATEGORY_NAME, ...defaultCategories];
setCategories(fullCategories);
const activeFilter = !!profile?.objective ? RECOMMENDED_CATEGORY_NAME : ALL_CATEGORY_NAME;
const activeFilter =
!!profile?.objective && profile.objective !== "other" ? RECOMMENDED_CATEGORY_NAME : ALL_CATEGORY_NAME;
setSelectedFilter(activeFilter);
}, [profile]);

View File

@@ -95,7 +95,7 @@ const Objective: React.FC<ObjectiveProps> = ({ next, skip }) => {
</div>
</div>
<div className="mb-24 flex justify-between">
<Button size="lg" className="text-slate-400" variant="minimal" onClick={skip}>
<Button size="lg" className="text-slate-400" variant="minimal" onClick={skip} id="objective-skip">
Skip
</Button>
<Button
@@ -103,7 +103,8 @@ const Objective: React.FC<ObjectiveProps> = ({ next, skip }) => {
variant="darkCTA"
loading={isMutatingProfile}
disabled={!selectedChoice}
onClick={handleNextClick}>
onClick={handleNextClick}
id="objective-next">
Next
</Button>
</div>

View File

@@ -90,7 +90,7 @@ const Role: React.FC<Role> = ({ next, skip }) => {
</div>
</div>
<div className="mb-24 flex justify-between">
<Button size="lg" className="text-slate-400" variant="minimal" onClick={skip}>
<Button size="lg" className="text-slate-400" variant="minimal" onClick={skip} id="role-skip">
Skip
</Button>
<Button
@@ -98,7 +98,8 @@ const Role: React.FC<Role> = ({ next, skip }) => {
variant="darkCTA"
loading={isMutatingProfile}
disabled={!selectedChoice}
onClick={handleNextClick}>
onClick={handleNextClick}
id="role-next">
Next
</Button>
</div>