mirror of
https://github.com/yangshun/tech-interview-handbook.git
synced 2026-03-30 17:10:16 +08:00
[offers][feat] Add logo (#461)
* [offers][feat] Add logo * [offers][fix] Fix table pagination * [offers][fix] Disable button on submit
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import { CurrencyDollarIcon } from '@heroicons/react/24/outline';
|
||||
|
||||
import type { ProductNavigationItems } from '~/components/global/ProductNavigation';
|
||||
|
||||
const navigation: ProductNavigationItems = [
|
||||
@@ -11,10 +9,7 @@ const config = {
|
||||
// TODO: Change this to your own GA4 measurement ID.
|
||||
googleAnalyticsMeasurementID: 'G-34XRGLEVCF',
|
||||
logo: (
|
||||
<CurrencyDollarIcon
|
||||
aria-label="Tech Interview Handbook Offers"
|
||||
className="h-8 w-8"
|
||||
/>
|
||||
<img alt="Tech Offers Repo" className="h-8 w-auto" src="/offers-logo.svg" />
|
||||
),
|
||||
navigation,
|
||||
showGlobalNav: false,
|
||||
|
||||
@@ -118,31 +118,33 @@ export default function OfferAnalysis({
|
||||
];
|
||||
|
||||
return (
|
||||
analysis && (
|
||||
<div>
|
||||
{isError && (
|
||||
<p className="m-10 text-center">
|
||||
An error occurred while generating profile analysis.
|
||||
</p>
|
||||
)}
|
||||
{isLoading && <Spinner className="m-10" display="block" size="lg" />}
|
||||
{!isError && !isLoading && (
|
||||
<div>
|
||||
<Tabs
|
||||
label="Result Navigation"
|
||||
tabs={tabOptions}
|
||||
value={tab}
|
||||
onChange={setTab}
|
||||
/>
|
||||
<HorizontalDivider className="mb-5" />
|
||||
<OfferAnalysisContent
|
||||
analysis={analysis}
|
||||
isSubmission={isSubmission}
|
||||
tab={tab}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
<>
|
||||
{isLoading && <Spinner className="m-10" display="block" size="lg" />}
|
||||
{analysis && (
|
||||
<div>
|
||||
{isError && (
|
||||
<p className="m-10 text-center">
|
||||
An error occurred while generating profile analysis.
|
||||
</p>
|
||||
)}
|
||||
{!isError && !isLoading && (
|
||||
<div>
|
||||
<Tabs
|
||||
label="Result Navigation"
|
||||
tabs={tabOptions}
|
||||
value={tab}
|
||||
onChange={setTab}
|
||||
/>
|
||||
<HorizontalDivider className="mb-5" />
|
||||
<OfferAnalysisContent
|
||||
analysis={analysis}
|
||||
isSubmission={isSubmission}
|
||||
tab={tab}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -110,7 +110,11 @@ export default function OffersSubmissionForm({
|
||||
defaultValues: initialOfferProfileValues,
|
||||
mode: 'all',
|
||||
});
|
||||
const { handleSubmit, trigger } = formMethods;
|
||||
const {
|
||||
handleSubmit,
|
||||
trigger,
|
||||
formState: { isSubmitting, isSubmitSuccessful },
|
||||
} = formMethods;
|
||||
|
||||
const generateAnalysisMutation = trpc.useMutation(
|
||||
['offers.analysis.generate'],
|
||||
@@ -178,7 +182,7 @@ export default function OffersSubmissionForm({
|
||||
|
||||
const onSubmit: SubmitHandler<OffersProfileFormData> = async (data) => {
|
||||
const result = await trigger();
|
||||
if (!result) {
|
||||
if (!result || isSubmitting || isSubmitSuccessful) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -286,7 +290,13 @@ export default function OffersSubmissionForm({
|
||||
variant="secondary"
|
||||
onClick={() => setStep(step - 1)}
|
||||
/>
|
||||
<Button label="Submit" type="submit" variant="primary" />{' '}
|
||||
<Button
|
||||
disabled={isSubmitting || isSubmitSuccessful}
|
||||
isLoading={isSubmitting || isSubmitSuccessful}
|
||||
label="Submit"
|
||||
type="submit"
|
||||
variant="primary"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</form>
|
||||
|
||||
@@ -159,7 +159,7 @@ export default function OffersTable({
|
||||
}
|
||||
|
||||
const handlePageChange = (currPage: number) => {
|
||||
if (0 < currPage && currPage < pagination.numOfPages) {
|
||||
if (0 <= currPage && currPage < pagination.numOfPages) {
|
||||
setPagination({ ...pagination, currentPage: currPage });
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user