Check if new user (#3586)
* add detection for new users for intro component * fix lint issue * changeset * remove redundant fragment --------- Co-authored-by: Elephant Lumps <celestial_vault@Elephants-MacBook-Pro.local>
This commit is contained in:
1 parent
5147e28aaf
commit
aabe4ae1e1
6 files changed
+23
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"claude-dev": minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Add detection for new users to display special components
|
||||||
@@ -146,8 +146,18 @@ export class Controller {
|
|||||||
chatSettings,
|
chatSettings,
|
||||||
shellIntegrationTimeout,
|
shellIntegrationTimeout,
|
||||||
enableCheckpointsSetting,
|
enableCheckpointsSetting,
|
||||||
|
isNewUser,
|
||||||
|
taskHistory,
|
||||||
} = await getAllExtensionState(this.context)
|
} = await getAllExtensionState(this.context)
|
||||||
|
|
||||||
|
const NEW_USER_TASK_COUNT_THRESHOLD = 10
|
||||||
|
|
||||||
|
// Check if the user has completed enough tasks to no longer be considered a "new user"
|
||||||
|
if (isNewUser && !historyItem && taskHistory && taskHistory.length >= NEW_USER_TASK_COUNT_THRESHOLD) {
|
||||||
|
await updateGlobalState(this.context, "isNewUser", false)
|
||||||
|
await this.postStateToWebview()
|
||||||
|
}
|
||||||
|
|
||||||
if (autoApprovalSettings) {
|
if (autoApprovalSettings) {
|
||||||
const updatedAutoApprovalSettings = {
|
const updatedAutoApprovalSettings = {
|
||||||
...autoApprovalSettings,
|
...autoApprovalSettings,
|
||||||
@@ -1357,6 +1367,7 @@ export class Controller {
|
|||||||
enableCheckpointsSetting,
|
enableCheckpointsSetting,
|
||||||
globalClineRulesToggles,
|
globalClineRulesToggles,
|
||||||
shellIntegrationTimeout,
|
shellIntegrationTimeout,
|
||||||
|
isNewUser,
|
||||||
} = await getAllExtensionState(this.context)
|
} = await getAllExtensionState(this.context)
|
||||||
|
|
||||||
const localClineRulesToggles =
|
const localClineRulesToggles =
|
||||||
@@ -1399,6 +1410,7 @@ export class Controller {
|
|||||||
localCursorRulesToggles: localCursorRulesToggles || {},
|
localCursorRulesToggles: localCursorRulesToggles || {},
|
||||||
workflowToggles: workflowToggles || {},
|
workflowToggles: workflowToggles || {},
|
||||||
shellIntegrationTimeout,
|
shellIntegrationTimeout,
|
||||||
|
isNewUser,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,5 +88,6 @@ export type GlobalStateKey =
|
|||||||
| "favoritedModelIds"
|
| "favoritedModelIds"
|
||||||
| "requestTimeoutMs"
|
| "requestTimeoutMs"
|
||||||
| "shellIntegrationTimeout"
|
| "shellIntegrationTimeout"
|
||||||
|
| "isNewUser"
|
||||||
|
|
||||||
export type LocalStateKey = "localClineRulesToggles"
|
export type LocalStateKey = "localClineRulesToggles"
|
||||||
@@ -76,6 +76,7 @@ async function migrateEnableCheckpointsSetting(enableCheckpointsSettingRaw: bool
|
|||||||
|
|
||||||
export async function getAllExtensionState(context: vscode.ExtensionContext) {
|
export async function getAllExtensionState(context: vscode.ExtensionContext) {
|
||||||
const [
|
const [
|
||||||
|
isNewUser,
|
||||||
storedApiProvider,
|
storedApiProvider,
|
||||||
apiModelId,
|
apiModelId,
|
||||||
apiKey,
|
apiKey,
|
||||||
@@ -162,6 +163,7 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
|
|||||||
enableCheckpointsSettingRaw,
|
enableCheckpointsSettingRaw,
|
||||||
mcpMarketplaceEnabledRaw,
|
mcpMarketplaceEnabledRaw,
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
|
getGlobalState(context, "isNewUser") as Promise<boolean | undefined>,
|
||||||
getGlobalState(context, "apiProvider") as Promise<ApiProvider | undefined>,
|
getGlobalState(context, "apiProvider") as Promise<ApiProvider | undefined>,
|
||||||
getGlobalState(context, "apiModelId") as Promise<string | undefined>,
|
getGlobalState(context, "apiModelId") as Promise<string | undefined>,
|
||||||
getSecret(context, "apiKey") as Promise<string | undefined>,
|
getSecret(context, "apiKey") as Promise<string | undefined>,
|
||||||
@@ -354,6 +356,7 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
|
|||||||
favoritedModelIds,
|
favoritedModelIds,
|
||||||
requestTimeoutMs,
|
requestTimeoutMs,
|
||||||
},
|
},
|
||||||
|
isNewUser: isNewUser ?? true,
|
||||||
lastShownAnnouncementId,
|
lastShownAnnouncementId,
|
||||||
customInstructions,
|
customInstructions,
|
||||||
taskHistory,
|
taskHistory,
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ export type Platform = "aix" | "darwin" | "freebsd" | "linux" | "openbsd" | "sun
|
|||||||
export const DEFAULT_PLATFORM = "unknown"
|
export const DEFAULT_PLATFORM = "unknown"
|
||||||
|
|
||||||
export interface ExtensionState {
|
export interface ExtensionState {
|
||||||
|
isNewUser: boolean
|
||||||
apiConfiguration?: ApiConfiguration
|
apiConfiguration?: ApiConfiguration
|
||||||
autoApprovalSettings: AutoApprovalSettings
|
autoApprovalSettings: AutoApprovalSettings
|
||||||
browserSettings: BrowserSettings
|
browserSettings: BrowserSettings
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ export const ExtensionStateContextProvider: React.FC<{
|
|||||||
localWindsurfRulesToggles: {},
|
localWindsurfRulesToggles: {},
|
||||||
workflowToggles: {},
|
workflowToggles: {},
|
||||||
shellIntegrationTimeout: 4000, // default timeout for shell integration
|
shellIntegrationTimeout: 4000, // default timeout for shell integration
|
||||||
|
isNewUser: false,
|
||||||
})
|
})
|
||||||
const [didHydrateState, setDidHydrateState] = useState(false)
|
const [didHydrateState, setDidHydrateState] = useState(false)
|
||||||
const [showWelcome, setShowWelcome] = useState(false)
|
const [showWelcome, setShowWelcome] = useState(false)
|
||||||
|
|||||||
Reference in new issue
Block a user