mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2026-09-24 15:00:31 +08:00
Regenerate functionality
This commit is contained in:
@@ -2,7 +2,6 @@ import { PenSquare, RefreshCcw } from 'lucide-react';
|
||||
import { useRef, useState } from 'react';
|
||||
import { useOutsideClick } from '../../hooks/use-outside-click';
|
||||
import { cn } from '../../lib/classname';
|
||||
import { useIsPaidUser } from '../../queries/billing';
|
||||
import { UpgradeAccountModal } from '../Billing/UpgradeAccountModal';
|
||||
import { ModifyCoursePrompt } from './ModifyCoursePrompt';
|
||||
|
||||
@@ -19,8 +18,6 @@ export function RegenerateLesson(props: RegenerateLessonProps) {
|
||||
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
|
||||
const { isPaidUser } = useIsPaidUser();
|
||||
|
||||
useOutsideClick(ref, () => setIsDropdownVisible(false));
|
||||
|
||||
return (
|
||||
@@ -58,12 +55,7 @@ export function RegenerateLesson(props: RegenerateLessonProps) {
|
||||
<div className="absolute right-0 top-full min-w-[170px] overflow-hidden rounded-md border border-gray-200 bg-white">
|
||||
<button
|
||||
onClick={() => {
|
||||
if (!isPaidUser) {
|
||||
setIsDropdownVisible(false);
|
||||
setShowUpgradeModal(true);
|
||||
} else {
|
||||
onRegenerateLesson();
|
||||
}
|
||||
onRegenerateLesson();
|
||||
}}
|
||||
className="flex w-full items-center gap-2.5 px-3 py-2 text-left text-sm text-gray-600 hover:bg-gray-100"
|
||||
>
|
||||
@@ -77,11 +69,7 @@ export function RegenerateLesson(props: RegenerateLessonProps) {
|
||||
<button
|
||||
onClick={() => {
|
||||
setIsDropdownVisible(false);
|
||||
if (!isPaidUser) {
|
||||
setShowUpgradeModal(true);
|
||||
} else {
|
||||
setShowPromptModal(true);
|
||||
}
|
||||
setShowPromptModal(true);
|
||||
}}
|
||||
className="flex w-full items-center gap-2.5 px-3 py-2 text-left text-sm text-gray-600 hover:bg-gray-100"
|
||||
>
|
||||
|
||||
@@ -2,7 +2,6 @@ import { PenSquare, RefreshCcw } from 'lucide-react';
|
||||
import { useRef, useState } from 'react';
|
||||
import { useOutsideClick } from '../../hooks/use-outside-click';
|
||||
import { cn } from '../../lib/classname';
|
||||
import { useIsPaidUser } from '../../queries/billing';
|
||||
import { UpgradeAccountModal } from '../Billing/UpgradeAccountModal';
|
||||
import { ModifyCoursePrompt } from './ModifyCoursePrompt';
|
||||
|
||||
@@ -19,8 +18,6 @@ export function RegenerateOutline(props: RegenerateOutlineProps) {
|
||||
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
|
||||
const { isPaidUser } = useIsPaidUser();
|
||||
|
||||
useOutsideClick(ref, () => setIsDropdownVisible(false));
|
||||
|
||||
return (
|
||||
@@ -56,12 +53,7 @@ export function RegenerateOutline(props: RegenerateOutlineProps) {
|
||||
<div className="absolute right-0 top-full min-w-[170px] overflow-hidden rounded-md border border-gray-200 bg-white">
|
||||
<button
|
||||
onClick={() => {
|
||||
if (!isPaidUser) {
|
||||
setIsDropdownVisible(false);
|
||||
setShowUpgradeModal(true);
|
||||
} else {
|
||||
onRegenerateOutline();
|
||||
}
|
||||
onRegenerateOutline();
|
||||
}}
|
||||
className="flex w-full items-center gap-2.5 px-3 py-2 text-left text-sm text-gray-600 hover:bg-gray-100"
|
||||
>
|
||||
@@ -75,11 +67,7 @@ export function RegenerateOutline(props: RegenerateOutlineProps) {
|
||||
<button
|
||||
onClick={() => {
|
||||
setIsDropdownVisible(false);
|
||||
if (!isPaidUser) {
|
||||
setShowUpgradeModal(true);
|
||||
} else {
|
||||
setShowPromptModal(true);
|
||||
}
|
||||
setShowPromptModal(true);
|
||||
}}
|
||||
className="flex w-full items-center gap-2.5 px-3 py-2 text-left text-sm text-gray-600 hover:bg-gray-100"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user