[offers][refactor] tweak submit and analysis steps UI

pull/492/head
Yangshun Tay 3 years ago
parent 55e93102de
commit 48dccb821e

@ -1,6 +1,6 @@
import { useEffect } from 'react'; import { useEffect } from 'react';
import { useState } from 'react'; import { useState } from 'react';
import { HorizontalDivider, Spinner, Tabs } from '@tih/ui'; import { Alert, HorizontalDivider, Spinner, Tabs } from '@tih/ui';
import OfferPercentileAnalysisText from './OfferPercentileAnalysisText'; import OfferPercentileAnalysisText from './OfferPercentileAnalysisText';
import OfferProfileCard from './OfferProfileCard'; import OfferProfileCard from './OfferProfileCard';
@ -22,17 +22,19 @@ function OfferAnalysisContent({
if (!analysis || analysis.noOfOffers === 0) { if (!analysis || analysis.noOfOffers === 0) {
if (tab === OVERALL_TAB) { if (tab === OVERALL_TAB) {
return ( return (
<p className="m-10"> <Alert title="Insufficient data to compare with" variant="info">
You are the first to submit an offer for your job title and YOE! Check You are among the first to submit an offer for your job title and
back later when there are more submissions. years of experience! Check back later when there are more submissions.
</p> </Alert>
); );
} }
return ( return (
<p className="m-10"> <Alert title="Insufficient data to compare with" variant="info">
You are the first to submit an offer for this company, job title and You are among the first to submit an offer for this company, job title
YOE! Check back later when there are more submissions. and years of experience! Check back later when there are more
</p> submissions.
</Alert>
); );
} }
return ( return (

@ -73,18 +73,24 @@ export default function OffersProfileSave({
}; };
return ( return (
<div className="flex w-full justify-center"> <div className="flex w-full justify-center pb-10">
<div className="max-w-2xl text-center"> <div className="max-w-2xl text-center">
<h5 className="mb-6 text-4xl font-bold text-slate-900"> <h2 className="block text-center text-3xl font-bold leading-8 tracking-tight text-gray-900 sm:text-4xl">
Save for future edits Save for future edits
</h5> </h2>
<p className="mb-2 text-slate-900">We value your privacy.</p> <p className="mt-4 text-xl leading-8 text-slate-500">
<p className="mb-5 text-slate-900"> We value your privacy
To keep you offer profile strictly anonymous, only people who have the
link below can edit it.
</p> </p>
<div className="mb-20 grid grid-cols-12 gap-4"> <div className="mt-6 max-w-md text-slate-500">
<div className="col-span-11"> <div className="bg-info-50 rounded-lg p-6">
<p className="sm:tex-base text-sm">
To keep your offer profile strictly anonymous, it is not linked to
your user account. Only people who have the link below can edit
it. If you want to edit the profile in future, store the link
somewhere.
</p>
<div className="mt-4 flex gap-4">
<div className="grow">
<TextInput <TextInput
disabled={true} disabled={true}
isLabelHidden={true} isLabelHidden={true}
@ -96,7 +102,7 @@ export default function OffersProfileSave({
icon={DocumentDuplicateIcon} icon={DocumentDuplicateIcon}
isLabelHidden={true} isLabelHidden={true}
label="Copy" label="Copy"
variant="primary" variant="info"
onClick={() => { onClick={() => {
copyProfileLink(profileId, token); copyProfileLink(profileId, token);
showToast({ showToast({
@ -111,22 +117,25 @@ export default function OffersProfileSave({
}} }}
/> />
</div> </div>
<p className="mb-5 text-slate-900"> </div>
If you do not want to keep the edit link, you can opt to save this <p className="mt-6 text-xs sm:text-sm">
profile under your account's dashboard. It will still only be editable If you do not want to manually store the link somewhere else, you
by you. can add this offers profile to your user account by clicking the
button below. It will still only be editable by you.
</p> </p>
<div className="mb-20"> <div className="mt-6">
<Button <Button
disabled={isSavedQuery.isLoading || isSaved} disabled={isSavedQuery.isLoading || isSaved}
icon={isSaved ? CheckIcon : BookmarkSquareIcon} icon={isSaved ? CheckIcon : BookmarkSquareIcon}
isLoading={saveMutation.isLoading || isSavedQuery.isLoading} isLoading={saveMutation.isLoading || isSavedQuery.isLoading}
label={isSaved ? 'Saved to user profile' : 'Save to user profile'} label={isSaved ? 'Added to account' : 'Add to your account'}
variant="primary" size="sm"
variant="secondary"
onClick={handleSave} onClick={handleSave}
/> />
</div> </div>
</div> </div>
</div> </div>
</div>
); );
} }

@ -15,10 +15,12 @@ export default function OffersSubmissionAnalysis({
return ( return (
<div className="mb-8"> <div className="mb-8">
<h5 className="mb-8 text-center text-4xl font-bold text-slate-900"> <h5 className="mb-8 text-center text-4xl font-bold text-slate-900">
Result Offer Analysis
</h5> </h5>
{!analysis && ( {!analysis && (
<p className="mb-8 text-center">Error generating analysis.</p> <p className="text-error-500 mb-8 text-center">
Error generating analysis.
</p>
)} )}
{analysis && ( {analysis && (
<OfferAnalysis <OfferAnalysis

@ -267,7 +267,7 @@ export default function OffersSubmissionForm({
<div ref={pageRef} className="w-full overflow-y-scroll"> <div ref={pageRef} className="w-full overflow-y-scroll">
<div className="flex justify-center"> <div className="flex justify-center">
<div className="block w-full max-w-screen-md overflow-hidden rounded-lg sm:shadow-lg md:my-10"> <div className="block w-full max-w-screen-md overflow-hidden rounded-lg sm:shadow-lg md:my-10">
<div className="bg-primary-100 flex justify-center px-4 py-4 sm:px-6 lg:px-8"> <div className="flex justify-center bg-slate-100 px-4 py-4 sm:px-6 lg:px-8">
<Breadcrumbs <Breadcrumbs
currentStep={step} currentStep={step}
setStep={setStep} setStep={setStep}

@ -78,16 +78,17 @@ export default function OffersSubmissionResult() {
</div> </div>
)} )}
{!getAnalysis.isLoading && ( {!getAnalysis.isLoading && (
<div ref={pageRef} className="fixed h-full w-full overflow-y-scroll"> <div ref={pageRef} className="w-full overflow-y-scroll">
<div className="mb-20 flex justify-center"> <div className="flex justify-center">
<div className="my-5 block w-full max-w-screen-md rounded-lg bg-white py-10 px-10 shadow-lg"> <div className="block w-full max-w-screen-md overflow-hidden rounded-lg sm:shadow-lg md:my-10">
<div className="mb-4 flex justify-end"> <div className="flex justify-center bg-slate-100 px-4 py-4 sm:px-6 lg:px-8">
<Breadcrumbs <Breadcrumbs
currentStep={step} currentStep={step}
setStep={setStep} setStep={setStep}
steps={breadcrumbSteps} steps={breadcrumbSteps}
/> />
</div> </div>
<div className="bg-white p-6 sm:p-10">
{steps[step]} {steps[step]}
{step === 0 && ( {step === 0 && (
<div className="flex justify-end"> <div className="flex justify-end">
@ -95,7 +96,7 @@ export default function OffersSubmissionResult() {
disabled={false} disabled={false}
icon={ArrowRightIcon} icon={ArrowRightIcon}
label="Next" label="Next"
variant="secondary" variant="primary"
onClick={() => setStep(step + 1)} onClick={() => setStep(step + 1)}
/> />
</div> </div>
@ -123,6 +124,7 @@ export default function OffersSubmissionResult() {
</div> </div>
</div> </div>
</div> </div>
</div>
)} )}
</> </>
); );

@ -12,10 +12,7 @@ import { createValidationRegex } from '~/utils/offers/zodRegex';
import { createRouter } from '../context'; import { createRouter } from '../context';
const getOrder = (prefix: string) => { const getOrder = (prefix: string) => {
if (prefix === '+') { return prefix === '+' ? 'asc' : 'desc';
return 'asc';
}
return 'desc';
}; };
const sortingKeysMap = { const sortingKeysMap = {

Loading…
Cancel
Save