feat: feedback updates

This commit is contained in:
Yunus M 2024-10-28 18:33:56 +05:30
parent c49a9dac1a
commit 5c02250aae
5 changed files with 152 additions and 77 deletions

View File

@ -33,7 +33,7 @@ const hearAboutSignozOptions: Record<string, string> = {
const interestedInOptions: Record<string, string> = {
savingCosts: 'Saving costs',
otelNativeStack: 'Interested in Otel-native stack',
allInOne: 'All in one',
allInOne: 'All in one (Logs, Metrics & Traces)',
};
export function AboutSigNozQuestions({
@ -144,7 +144,7 @@ export function AboutSigNozQuestions({
<Input
type="text"
className="onboarding-questionaire-other-input"
placeholder="Tell us how you got to know about us"
placeholder="How you got to know about us"
value={otherAboutSignoz}
autoFocus
addonAfter={

View File

@ -1,26 +1,12 @@
import './OnboardingHeader.styles.scss';
import { Color } from '@signozhq/design-tokens';
import { Button } from 'antd';
import { LifeBuoy } from 'lucide-react';
export function OnboardingHeader(): JSX.Element {
const handleGetHelpClick = (): void => {
if (window.Intercom) {
window.Intercom('showNewMessage', '');
}
};
return (
<div className="header-container">
<div className="logo-container">
<img src="/Logos/signoz-brand-logo-new.svg" alt="SigNoz" />
<span className="logo-text">SigNoz</span>
</div>
<Button className="get-help-container" onClick={handleGetHelpClick}>
<LifeBuoy size={12} color={Color.BG_VANILLA_400} />
<span className="get-help-text ">Get Help</span>
</Button>
</div>
);
}

View File

@ -1,4 +1,4 @@
import { Button, Slider, SliderSingleProps, Typography } from 'antd';
import { Button, Slider, Typography } from 'antd';
import logEvent from 'api/common/logEvent';
import { ArrowLeft, ArrowRight, Loader2, Minus } from 'lucide-react';
import { useEffect, useState } from 'react';
@ -9,6 +9,28 @@ export interface OptimiseSignozDetails {
services: number;
}
// Define exponential range
const logsMin = 1; // Set to your minimum value in the exponential range
const logsMax = 10000; // Set to your maximum value in the exponential range
const hostsMin = 1;
const hostsMax = 10000;
const servicesMin = 1;
const servicesMax = 5000;
// Function to convert linear slider value to exponential scale
const linearToExponential = (
value: number,
min: number,
max: number,
): number => {
const expMin = Math.log10(min);
const expMax = Math.log10(max);
const expValue = 10 ** (expMin + ((expMax - expMin) * value) / 100);
return Math.round(expValue);
};
interface OptimiseSignozNeedsProps {
optimiseSignozDetails: OptimiseSignozDetails;
setOptimiseSignozDetails: (details: OptimiseSignozDetails) => void;
@ -19,29 +41,28 @@ interface OptimiseSignozNeedsProps {
isNextDisabled: boolean;
}
const logMarks: SliderSingleProps['marks'] = {
0: '0 GB',
25: '25 GB',
50: '50 GB',
100: '100 GB',
const marks = {
0: `${linearToExponential(0, logsMin, logsMax).toLocaleString()} GB`,
25: `${linearToExponential(25, logsMin, logsMax).toLocaleString()} GB`,
50: `${linearToExponential(50, logsMin, logsMax).toLocaleString()} GB`,
75: `${linearToExponential(75, logsMin, logsMax).toLocaleString()} GB`,
100: `${linearToExponential(100, logsMin, logsMax).toLocaleString()} GB`,
};
const hostMarks: SliderSingleProps['marks'] = {
0: '0',
20: '20',
40: '40',
60: '60',
80: '80',
100: '100',
const hostMarks = {
0: `${linearToExponential(0, hostsMin, hostsMax).toLocaleString()}`,
25: `${linearToExponential(25, hostsMin, hostsMax).toLocaleString()}`,
50: `${linearToExponential(50, hostsMin, hostsMax).toLocaleString()}`,
75: `${linearToExponential(75, hostsMin, hostsMax).toLocaleString()}`,
100: `${linearToExponential(100, hostsMin, hostsMax).toLocaleString()}`,
};
const serviceMarks: SliderSingleProps['marks'] = {
0: '0',
20: '20',
40: '40',
60: '60',
80: '80',
100: '100',
const serviceMarks = {
0: `${linearToExponential(0, servicesMin, servicesMax).toLocaleString()}`,
25: `${linearToExponential(25, servicesMin, servicesMax).toLocaleString()}`,
50: `${linearToExponential(50, servicesMin, servicesMax).toLocaleString()}`,
75: `${linearToExponential(75, servicesMin, servicesMax).toLocaleString()}`,
100: `${linearToExponential(100, servicesMin, servicesMax).toLocaleString()}`,
};
function OptimiseSignozNeeds({
@ -108,6 +129,52 @@ function OptimiseSignozNeeds({
});
};
// Internal state for the linear slider
const [sliderValues, setSliderValues] = useState({
logsPerDay: 0,
hostsPerDay: 0,
services: 0,
});
const handleSliderChange = (key: string, value: number): void => {
console.log('value', value);
setSliderValues({
...sliderValues,
[key]: value,
});
switch (key) {
case 'logsPerDay':
setLogsPerDay(value);
break;
case 'hostsPerDay':
setHostsPerDay(value);
break;
case 'services':
setServices(value);
break;
default:
break;
}
};
// Calculate the exponential value based on the current slider position
const logsPerDayValue = linearToExponential(
sliderValues.logsPerDay,
logsMin,
logsMax,
);
const hostsPerDayValue = linearToExponential(
sliderValues.hostsPerDay,
hostsMin,
hostsMax,
);
const servicesValue = linearToExponential(
sliderValues.services,
servicesMin,
servicesMax,
);
return (
<div className="questions-container">
<Typography.Title level={3} className="title">
@ -128,55 +195,82 @@ function OptimiseSignozNeeds({
Logs / Day
</label>
<div className="slider-container">
<div>
<Slider
marks={logMarks}
defaultValue={logsPerDay}
onAfterChange={(value): void => setLogsPerDay(value)}
min={0}
max={100}
value={sliderValues.logsPerDay}
marks={marks}
onChange={(value: number): void =>
handleSliderChange('logsPerDay', value)
}
styles={{
track: {
background: '#4E74F8',
},
}}
tooltip={{
formatter: (): string => `${logsPerDayValue.toLocaleString()} GB`, // Show whole number
}}
/>
</div>
</div>
</div>
<div className="form-group">
<label className="question" htmlFor="organisationName">
Metrics <Minus size={14} /> Number of Hosts
</label>
<div className="slider-container">
<div>
<Slider
min={0}
max={100}
value={sliderValues.hostsPerDay}
marks={hostMarks}
defaultValue={hostsPerDay}
onAfterChange={(value: number): void => setHostsPerDay(value)}
onChange={(value: number): void =>
handleSliderChange('hostsPerDay', value)
}
styles={{
track: {
background: '#4E74F8',
},
}}
tooltip={{
formatter: (): string => `${hostsPerDayValue.toLocaleString()}`, // Show whole number
}}
/>
</div>
</div>
</div>
<div className="form-group">
<label className="question" htmlFor="organisationName">
Number of services
</label>
<div className="slider-container">
<div>
<Slider
min={0}
max={100}
value={sliderValues.services}
marks={serviceMarks}
defaultValue={services}
onAfterChange={(value): void => setServices(value)}
onChange={(value: number): void =>
handleSliderChange('services', value)
}
styles={{
track: {
background: '#4E74F8',
},
}}
tooltip={{
formatter: (): string => `${servicesValue.toLocaleString()}`, // Show whole number
}}
/>
</div>
</div>
</div>
</div>
<div className="next-prev-container">
<Button

View File

@ -42,9 +42,9 @@ const observabilityTools = {
};
const o11yFamiliarityOptions: Record<string, string> = {
beginner: 'Basic Understanding',
intermediate: 'Somewhat Familiar',
expert: 'Very Familiar',
beginner: 'Beginner',
intermediate: 'Intermediate',
expert: 'Expert',
notFamiliar: "I'm not familiar with it",
};

View File

@ -28,7 +28,6 @@ import {
SignozDetails,
} from './AboutSigNozQuestions/AboutSigNozQuestions';
import InviteTeamMembers from './InviteTeamMembers/InviteTeamMembers';
import { OnboardingFooter } from './OnboardingFooter/OnboardingFooter';
import { OnboardingHeader } from './OnboardingHeader/OnboardingHeader';
import OptimiseSignozNeeds, {
OptimiseSignozDetails,
@ -148,8 +147,8 @@ function OnboardingQuestionaire(): JSX.Element {
}, [org]);
const isNextDisabled =
optimiseSignozDetails.logsPerDay === 0 ||
optimiseSignozDetails.hostsPerDay === 0 ||
optimiseSignozDetails.logsPerDay === 0 &&
optimiseSignozDetails.hostsPerDay === 0 &&
optimiseSignozDetails.services === 0;
const [isLoading, setIsLoading] = useState<boolean>(false);
@ -316,10 +315,6 @@ function OnboardingQuestionaire(): JSX.Element {
</>
)}
</div>
<div className="onboarding-questionaire-footer">
<OnboardingFooter />
</div>
</div>
);
}