Skip to content

Commit

Permalink
databricks-13 Bedre filter for kunder og rydding av kode
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverKnowit committed Mar 5, 2024
1 parent 7610c62 commit 4c61be7
Show file tree
Hide file tree
Showing 37 changed files with 636 additions and 542 deletions.
2 changes: 2 additions & 0 deletions apps/web/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
SKIP_PREFLIGHT_CHECK=true
HTTPS=true
BROWSER=none
CI=false
1 change: 1 addition & 0 deletions apps/web/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
rules: {
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'prefer-template': 'error',
},
settings: {
react: {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/api/data/customer/customerApiTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ConsultantInfo, CvLinks } from '../employee/employeeApiTypes'
import { TableRow } from '../tableResponses'

// customerCards
interface CustomerCardData {
export interface CustomerCardData {
customer: string
consultants: number
billedLastPeriod: number
Expand Down
7 changes: 6 additions & 1 deletion apps/web/src/api/data/customer/customerQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ import {
getHoursBilledPerWeekCharts,
} from './customerApi'

export const useCustomerCards = () =>
export const useCustomerCardsQuery = () =>
useSWR('/customerCards', getCustomerCards, {
revalidateOnFocus: false,
})

export const useCustomerCards = () => {
const { data } = useCustomerCardsQuery()
return data || []
}

export const useEmployeesByCustomer = () =>
useSWR('/employeesByCustomer', getEmployeesByCustomer, {
revalidateOnFocus: false,
Expand Down
8 changes: 4 additions & 4 deletions apps/web/src/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ const LinkStyled = styled('a')(({ theme }) => ({

export default function Footer() {
const domain = '.no'
const improvementsEmail =
'dataplattform' + String.fromCharCode(64) + `knowit${domain}`
const datacorrectionEmail =
'drift' + String.fromCharCode(64) + `knowit${domain}`
const improvementsEmail = `dataplattform${String.fromCharCode(
64
)}knowit${domain}`
const datacorrectionEmail = `drift${String.fromCharCode(64)}knowit${domain}`

const improvementsHref = `mailto:${improvementsEmail}`
const correctionHref = `mailto:${datacorrectionEmail}?subject=Melding%20om%20datafeil&body=Feilen%20ble%20funnet%20her%3A%20%0D%0AOg%20omhandler%20dette%3A%20`
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/charts/nivo/RadarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const RadarChart: React.FC<Props<any>> = ({ isBig = false, ...props }) => {
<tbody>
{data.data.map((dataRow, index) => {
return (
<tr key={data.index + ' ' + index}>
<tr key={`${data.index} ${index}`}>
<td style={{ padding: '3px 5px' }}>
<span
style={{
Expand Down
11 changes: 1 addition & 10 deletions apps/web/src/components/gridItem/GridItemContent.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react'
import { styled } from '@mui/material/styles'

const ComponentRoot = styled('div')(({ theme }) => ({
export const GridItemContent = styled('div')(({ theme }) => ({
width: '100%',
padding: 15,
fontSize: 16,
Expand All @@ -11,11 +10,3 @@ const ComponentRoot = styled('div')(({ theme }) => ({
borderRight: `1px solid ${theme.palette.background.darker}`,
borderRadius: '0px 0px 6px 6px',
}))

interface GridItemContentProps {
children: React.ReactNode | React.ReactNode[]
}

export function GridItemContent({ children }: GridItemContentProps) {
return <ComponentRoot>{children}</ComponentRoot>
}
3 changes: 2 additions & 1 deletion apps/web/src/components/gridItem/GridItemHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const GridHeaderTitle = styled('h2', {
fontWeight: green ? 'bold' : big ? 'normal' : 700,
paddingLeft: big && 11,
color: green && '#FFFFFF',
margin: 0,
})
)

Expand Down Expand Up @@ -69,7 +70,7 @@ export function GridItemHeader({
<Grid container direction="row" alignItems="center">
<GridHeaderTitle big={big} green={green} longTitleText={longTitleText}>
{card && clickable ? (
<OpenInNewLink to={'/kunder/' + title} target="_blank">
<OpenInNewLink to={`/kunder/${title}`} target="_blank">
{title}
</OpenInNewLink>
) : (
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/sortableTable/MUITable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const CheckboxContainer = styled('div')(() => ({
width: '60%',
}))

const FormControlLabelStyled = styled(FormControlLabel)(() => ({
export const FormControlLabelStyled = styled(FormControlLabel)(() => ({
marginRight: 0,
}))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default function ConsultantCell({
</ButtonSubRoot>
<ButtonSubRoot>
{isExpanded ? <ExpandLessIcon /> : <ExpandMoreIcon />}
<Link to={'/ansatt/' + consultant.email} target="_blank">
<Link to={`/ansatt/${consultant.email}`} target="_blank">
<OpenInNewIcon />
</Link>
</ButtonSubRoot>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default function FilteredDownloadCell({
const columns: string[] = []
columns.push(filter.label)
filter.filters.forEach((entry) => {
columns.push(entry.value + ':' + entry.threshold)
columns.push(`${entry.value}:${entry.threshold}`)
})
rows.push(columns)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ export function createXlsLinks(rows: string[][], filename: string) {
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = filename + '.xlsx'
link.download = `${filename}.xlsx`
link.click()
})
}
1 change: 0 additions & 1 deletion apps/web/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { BrowserRouter } from 'react-router-dom'

import App from './App'
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/pages/customer/CustomerPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import NavTab from '../../components/header/NavTab'
import CustomerList from './components/CustomerList'
import { CustomerOverview } from './components/CustomerOverview'
import CustomerList from './customer-list/CustomerList'
import { CustomerOverview } from './customer-overview/CustomerOverview'
import { pageTitle } from '../../utils/pagetitle'

export default function Customer() {
Expand Down
6 changes: 3 additions & 3 deletions apps/web/src/pages/customer/cards/CustomerCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,13 @@ const CustomerCard: React.FC<CustomerCardProps> = ({
>
{customerSpecificCard ? null : (
<CheckboxWrapper>
<Text htmlFor={'chk' + customer}>Vis kunde i graf</Text>
<Text htmlFor={`chk${customer}`}>Vis kunde i graf</Text>
<Checkbox
id={'chk' + customer}
id={`chk${customer}`}
checked={selectedCustomerIds.includes(customer)}
onChange={(event) => handleCheckboxChange(event, customer)}
/>
<LinkStyled to={'/kunder/' + customer}>
<LinkStyled to={`/kunder/${customer}`}>
<OpenInNewIcon />
</LinkStyled>
</CheckboxWrapper>
Expand Down
Loading

0 comments on commit 4c61be7

Please sign in to comment.