Skip to content

Commit

Permalink
fix: improving namings
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasz97 committed Sep 17, 2024
1 parent ec30c20 commit 8a45ccc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/components/report/ProductivitySection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface ReportProps {
selectedCustomersSig: Signal<string[]>;
selectedProjectsSig: Signal<Project[]>;
selectedTasksSig: Signal<Task[]>;
selectedNamesSig: Signal<UserProfile[]>;
selectedUsersSig: Signal<UserProfile[]>;
selectedTab: Signal<ReportTab>;
to: Signal<Date>;
from: Signal<Date>;
Expand All @@ -26,7 +26,7 @@ export const ProductivitySection = component$<ReportProps>(
selectedCustomersSig,
selectedProjectsSig,
selectedTasksSig,
selectedNamesSig,
selectedUsersSig,
selectedTab,
}) => {
const productivityTableRef = useSignal<HTMLElement>();
Expand All @@ -35,7 +35,7 @@ export const ProductivitySection = component$<ReportProps>(
selectedCustomersSig,
selectedProjectsSig,
selectedTasksSig,
selectedNamesSig,
selectedUsersSig,
from,
to,
selectedTab
Expand Down
10 changes: 5 additions & 5 deletions src/components/report/ProjectsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface ReportProps {
selectedCustomersSig: Signal<string[]>;
selectedProjectsSig: Signal<Project[]>;
selectedTasksSig: Signal<Task[]>;
selectedNamesSig: Signal<UserProfile[]>;
selectedUsersSig: Signal<UserProfile[]>;
selectedTab: Signal<ReportTab>;
to: Signal<Date>;
from: Signal<Date>;
Expand All @@ -26,7 +26,7 @@ export const ProjectsSection = component$<ReportProps>(
selectedCustomersSig,
selectedProjectsSig,
selectedTasksSig,
selectedNamesSig,
selectedUsersSig,
selectedTab,
}) => {
const projectReportDetailsRef = useSignal<HTMLElement>();
Expand All @@ -38,7 +38,7 @@ export const ProjectsSection = component$<ReportProps>(
selectedCustomersSig,
selectedProjectsSig,
selectedTasksSig,
selectedNamesSig,
selectedUsersSig,
from,
to,
selectedTab
Expand All @@ -48,12 +48,12 @@ export const ProjectsSection = component$<ReportProps>(
track(() => selectedCustomersSig.value);
track(() => selectedProjectsSig.value);
track(() => selectedTasksSig.value);
track(() => selectedNamesSig.value);
track(() => selectedUsersSig.value);
showProjectsDetails.value =
selectedCustomersSig.value.length !== 0 ||
selectedProjectsSig.value.length !== 0 ||
selectedTasksSig.value.length !== 0 ||
selectedNamesSig.value.length !== 0;
selectedUsersSig.value.length !== 0;
});

return (
Expand Down
12 changes: 6 additions & 6 deletions src/components/report/ReportFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ export const ReportFilters = component$<{
selectedCustomers: Signal<Customer[]>;
selectedProjects: Signal<Project[]>;
selectedTasks: Signal<Task[]>;
selectedNames: Signal<UserProfile[]>;
}>(({ selectedCustomers, selectedProjects, selectedTasks, selectedNames }) => {
selectedUsers: Signal<UserProfile[]>;
}>(({ selectedCustomers, selectedProjects, selectedTasks, selectedUsers }) => {
const getUniqueValues = sync$((arr: string[]): string[] => {
return [...new Set(arr)];
});

const _selectedProjects = useSignal(selectedProjects.value.map((project) => project.name));
const _selectedTasks = useSignal(selectedTasks.value.map((task) => task.name));
const _selectedUsers = useSignal(selectedNames.value.map((user) => user.name));
const _selectedUsers = useSignal(selectedUsers.value.map((user) => user.name));

const taskProjectCustomerSig = useComputed$(async () => {
return await getAllTasks();
Expand Down Expand Up @@ -150,7 +150,7 @@ export const ReportFilters = component$<{
});

const onChangeUser = $(() => {
selectedNames.value = _selectedUsers.value.map((user) => {
selectedUsers.value = _selectedUsers.value.map((user) => {
const value = usersSig.value.find((element) => element.name === user);
return (
value ?? {
Expand All @@ -164,9 +164,9 @@ export const ReportFilters = component$<{

const clearFilters = $(() => {
selectedCustomers.value = [];
selectedProjects.value = [];
_selectedProjects.value = [];
_selectedTasks.value = [];
selectedNames.value = [];
_selectedUsers.value = [];
});

return (
Expand Down
8 changes: 4 additions & 4 deletions src/pages/Report.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const Report = component$(() => {
const selectedCustomersSig = useSignal<Customer[]>([]);
const selectedProjectsSig = useSignal<Project[]>([]);
const selectedTasksSig = useSignal<Task[]>([]);
const selectedNamesSig = useSignal<UserProfile[]>([]);
const selectedUsersSig = useSignal<UserProfile[]>([]);
const selectedTab = useSignal<ReportTab>('project');

return (
Expand All @@ -40,7 +40,7 @@ export const Report = component$(() => {
selectedCustomers={selectedCustomersSig}
selectedProjects={selectedProjectsSig}
selectedTasks={selectedTasksSig}
selectedNames={selectedNamesSig}
selectedUsers={selectedUsersSig}
/>

{/* TAB Selection */}
Expand Down Expand Up @@ -95,7 +95,7 @@ export const Report = component$(() => {
selectedCustomersSig={selectedCustomersSig}
selectedProjectsSig={selectedProjectsSig}
selectedTasksSig={selectedTasksSig}
selectedNamesSig={selectedNamesSig}
selectedUsersSig={selectedUsersSig}
selectedTab={selectedTab}
to={to}
from={from}
Expand All @@ -111,7 +111,7 @@ export const Report = component$(() => {
selectedCustomersSig={selectedCustomersSig}
selectedProjectsSig={selectedProjectsSig}
selectedTasksSig={selectedTasksSig}
selectedNamesSig={selectedNamesSig}
selectedUsersSig={selectedUsersSig}
selectedTab={selectedTab}
to={to}
from={from}
Expand Down

0 comments on commit 8a45ccc

Please sign in to comment.