Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions ui/litellm-dashboard/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import PromptsPanel from "@/components/prompts";
import PublicModelHub from "@/components/public_model_hub";
import { SearchTools } from "@/components/search_tools";
import Settings from "@/components/settings";
import { SurveyPrompt, SurveyModal } from "@/components/survey";
import TagManagement from "@/components/tag_management";
import TransformRequestPanel from "@/components/transform_request";
import UIThemeSettings from "@/components/ui_theme_settings";
Expand Down Expand Up @@ -119,6 +120,10 @@ export default function CreateKeyPage() {
const [authLoading, setAuthLoading] = useState(true);
const [userID, setUserID] = useState<string | null>(null);

// Survey state - always show by default
const [showSurveyPrompt, setShowSurveyPrompt] = useState(true);
const [showSurveyModal, setShowSurveyModal] = useState(false);

const invitation_id = searchParams.get("invitation_id");

// Get page from URL, default to 'api-keys' if not present
Expand Down Expand Up @@ -262,6 +267,35 @@ export default function CreateKeyPage() {
}
}, [accessToken, userID, userRole]);

// Auto-dismiss survey prompt after 15 seconds
useEffect(() => {
if (showSurveyPrompt && !showSurveyModal) {
const timer = setTimeout(() => {
setShowSurveyPrompt(false);
}, 15000);
return () => clearTimeout(timer);
}
}, [showSurveyPrompt, showSurveyModal]);

const handleOpenSurvey = () => {
setShowSurveyPrompt(false);
setShowSurveyModal(true);
};

const handleDismissSurveyPrompt = () => {
setShowSurveyPrompt(false);
};

const handleSurveyComplete = () => {
setShowSurveyModal(false);
};

const handleSurveyModalClose = () => {
// If they close the modal without completing, show the prompt again
setShowSurveyModal(false);
setShowSurveyPrompt(true);
};

if (authLoading || redirectToLogin) {
return <LoadingScreen />;
}
Expand Down Expand Up @@ -457,6 +491,18 @@ export default function CreateKeyPage() {
/>
)}
</div>

{/* Survey Components */}
<SurveyPrompt
isVisible={showSurveyPrompt}
onOpen={handleOpenSurvey}
onDismiss={handleDismissSurveyPrompt}
/>
<SurveyModal
isOpen={showSurveyModal}
onClose={handleSurveyModalClose}
onComplete={handleSurveyComplete}
/>
</div>
)}
</ThemeProvider>
Expand Down
Loading
Loading