Skip to content

Commit

Permalink
name changes
Browse files Browse the repository at this point in the history
  • Loading branch information
anemne committed Sep 11, 2024
1 parent 984d386 commit efec4dd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
14 changes: 6 additions & 8 deletions src/compensations/Compensations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {

interface CompensationsProps {
compensations: CompensationsPage;
locations: CompanyLocation;
locations: CompanyLocation[];
}

interface SalaryCalculatorFormState {
Expand All @@ -24,7 +24,9 @@ interface SalaryCalculatorFormState {
}

const Compensations = ({ compensations, locations }: CompensationsProps) => {
const [selectedLocation, setSelectedLocation] = useState<string>("trondheim");
const [selectedLocation, setSelectedLocation] = useState<string>(
locations[0]._id,
);
const currentYear = new Date().getFullYear();
const [salary, setSalary] = useState<number | null>(null);
const [formState, setFormState] = useState<SalaryCalculatorFormState>({
Expand Down Expand Up @@ -57,13 +59,9 @@ const Compensations = ({ compensations, locations }: CompensationsProps) => {
);
};

const updateLocation = (id: string) => {
setSelectedLocation(id);
};

const locationOptions: IOption[] = Object.values(locations).map(
(companyLocation) => ({
id: companyLocation.companyLocationName.toLowerCase(),
id: companyLocation._id,
label: companyLocation.companyLocationName,
}),
);
Expand All @@ -76,7 +74,7 @@ const Compensations = ({ compensations, locations }: CompensationsProps) => {
label="Choose your location"
options={locationOptions}
selectedId={selectedLocation}
onValueChange={(selectedOption) => updateLocation(selectedOption.id)}
onValueChange={(option) => setSelectedLocation(option.id)}
/>
{compensations.showSalaryCalculator && (
<>
Expand Down
4 changes: 2 additions & 2 deletions src/compensations/CompensationsPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { COMPENSATIONS_PAGE_QUERY } from "studio/lib/queries/pages";

interface CompensationsPreviewProps {
initialCompensations: QueryResponseInitial<CompensationsPage>;
initialLocation: QueryResponseInitial<CompanyLocation>;
initialLocation: QueryResponseInitial<CompanyLocation[]>;
}

const CompensationsPreview = ({
Expand All @@ -22,7 +22,7 @@ const CompensationsPreview = ({
{ initial: initialCompensations },
);

const { data: locationData } = useQuery<CompanyLocation>(
const { data: locationData } = useQuery<CompanyLocation[]>(
COMPANY_LOCATIONS_QUERY,
{ initial: initialLocation },
);
Expand Down
2 changes: 1 addition & 1 deletion studio/lib/payloads/companyDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ export interface CompanyLocation {
_key: string;
_id: string;
_updatedAt: string;
companyLocation: string;
companyLocationName: string;
}
6 changes: 3 additions & 3 deletions studio/lib/payloads/compensations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ export interface Benefit {
richText: PortableTextBlock[];
}

export interface BenefitsGroup {
export interface BenefitsByLocation {
_key: string;
location: string;
benefitsGroup: Benefit[];
benefits: Benefit[];
}

export interface SalariesPage {
Expand All @@ -30,6 +30,6 @@ export interface CompensationsPage {
basicTitle: string;
page: string;
slug: Slug;
benefitsByLocation: BenefitsGroup[];
benefitsByLocation: BenefitsByLocation[];
showSalaryCalculator: boolean;
}

0 comments on commit efec4dd

Please sign in to comment.