Skip to content

Commit

Permalink
fix onboarding first check
Browse files Browse the repository at this point in the history
  • Loading branch information
a-type committed May 28, 2024
1 parent b14c735 commit 163be38
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,11 @@ export interface GroceryListItemProps {
isDragActive?: boolean;
style?: CSSProperties;
menuProps?: any;
first?: boolean;
}

export const GroceryListItem = forwardRef<HTMLDivElement, GroceryListItemProps>(
function GroceryListItem(
{ item, isDragActive, menuProps, className, first, ...rest },
{ item, isDragActive, menuProps, className, ...rest },
ref,
) {
const { purchasedAt, comment, id, food, textOverride } =
Expand Down Expand Up @@ -198,18 +197,14 @@ export const GroceryListItem = forwardRef<HTMLDivElement, GroceryListItemProps>(
// onContextMenu={preventDefault}
{...menuProps}
>
{first ? (
<OnboardingTooltip
onboarding={categorizeOnboarding}
step="categorize"
content="Tap and hold to change category"
disableNext
>
<DragHandleDots2Icon className="text-gray-5 hover:text-white" />
</OnboardingTooltip>
) : (
<DragHandleDots2Icon className="text-gray-5 hover:text-white" />
)}
<OnboardingTooltip
onboarding={categorizeOnboarding}
step="categorize"
content="Tap and hold to change category"
disableNext
>
<Icon name="grabby" className="text-gray-5" />
</OnboardingTooltip>
</div>
</div>
<CollapsibleTrigger asChild>
Expand Down
5 changes: 1 addition & 4 deletions apps/gnocchi/web/src/onboarding/firstTimeOnboarding.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { createOnboarding } from '@biscuits/client';

export const firstTimeOnboarding = createOnboarding('firstTime', [
'welcome',
'settings',
]);
export const firstTimeOnboarding = createOnboarding('firstTime', ['welcome']);
13 changes: 9 additions & 4 deletions packages/client/src/components/onboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,15 @@ export function createOnboarding<Steps extends StringTuple>(
// a unique ID for this invocation of this hook. useful if there
// are multiple mounted components using this same hook and name.
const id = useId();
if (stepClaims[name] === undefined) {
stepClaims[name] = id;
}
const hasClaim = true; // stepClaims[name] === id;
const hasClaim = stepClaims[name] === id;
useEffect(() => {
if (!stepClaims[name]) {
stepClaims[name] = id;
return () => {
delete stepClaims[name];
};
}
}, [id]);

const active = useSnapshot(state).active;

Expand Down

0 comments on commit 163be38

Please sign in to comment.