Skip to content

Commit

Permalink
Merge branch 'main' into feature/add-default-header-for-natturuhamfar…
Browse files Browse the repository at this point in the history
…atryggingar
  • Loading branch information
kodiakhq[bot] authored Sep 16, 2024
2 parents 6f1f55c + 01b8904 commit c268b2b
Show file tree
Hide file tree
Showing 22 changed files with 394 additions and 73 deletions.
15 changes: 8 additions & 7 deletions apps/native/app/src/screens/document-detail/document-detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -374,13 +374,14 @@ export const DocumentDetailScreen: NavigationFunctionComponent<{
(isHtml ? (
<WebView
source={{
html:
// Removing all <br /> tags to fix a bug in react-native that renders <br /> with too much vertical space
// https://github.com/facebook/react-native/issues/32062
`${htmlStyles}${Document.content?.value.replaceAll(
regexForBr,
'',
)}` ?? '',
html: Document.content?.value
? // Removing all <br /> tags to fix a bug in react-native that renders <br /> with too much vertical space
// https://github.com/facebook/react-native/issues/32062
`${htmlStyles}${Document.content?.value.replaceAll(
regexForBr,
'',
)}`
: '',
}}
scalesPageToFit
onLoadEnd={() => {
Expand Down
7 changes: 5 additions & 2 deletions apps/native/app/src/screens/home/air-discount-module.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const AirDiscountModule = React.memo(
)

const count = discounts?.length ?? 0
const viewPagerItemWidth = screenWidth - theme.spacing[2] * 4

const items = discounts?.slice(0, 3).map(({ discountCode, user }) => (
<AirDiscountCard
Expand All @@ -92,7 +93,7 @@ const AirDiscountModule = React.memo(
style={
count > 1
? {
width: screenWidth - theme.spacing[2] * 4,
width: viewPagerItemWidth,
marginLeft: theme.spacing[2],
}
: {
Expand Down Expand Up @@ -151,7 +152,9 @@ const AirDiscountModule = React.memo(
/>
)}
{count === 1 && items}
{count >= 2 && <ViewPager>{items}</ViewPager>}
{count >= 2 && (
<ViewPager itemWidth={viewPagerItemWidth}>{items}</ViewPager>
)}
</>
)}
</Host>
Expand Down
8 changes: 6 additions & 2 deletions apps/native/app/src/screens/home/applications-module.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ const ApplicationsModule = React.memo(
return null
}

const viewPagerItemWidth = screenWidth - theme.spacing[2] * 4

const items = applications.slice(0, 3).map((application) => (
<StatusCard
key={application.id}
Expand Down Expand Up @@ -98,7 +100,7 @@ const ApplicationsModule = React.memo(
style={
count > 1
? {
width: screenWidth - theme.spacing[2] * 4,
width: viewPagerItemWidth,
marginLeft: 16,
}
: {}
Expand Down Expand Up @@ -169,7 +171,9 @@ const ApplicationsModule = React.memo(
/>
)}
{count === 1 && items}
{count >= 2 && <ViewPager>{items}</ViewPager>}
{count >= 2 && (
<ViewPager itemWidth={viewPagerItemWidth}>{items}</ViewPager>
)}
</>
)}
</SafeAreaView>
Expand Down
7 changes: 5 additions & 2 deletions apps/native/app/src/screens/home/licenses-module.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ const LicensesModule = React.memo(
const count = licenses?.length ?? 0 + (passport ? 1 : 0)

const allLicenses = [...(licenses ?? []), ...(passport ?? [])]
const viewPagerItemWidth = screenWidth - theme.spacing[2] * 3

const items = allLicenses
.filter(
Expand All @@ -135,7 +136,7 @@ const LicensesModule = React.memo(
style={
count > 1
? {
width: screenWidth - theme.spacing[2] * 3,
width: viewPagerItemWidth,
paddingLeft: theme.spacing[2],
paddingRight: 0,
}
Expand Down Expand Up @@ -201,7 +202,9 @@ const LicensesModule = React.memo(
/>
)}
{count === 1 && items}
{count >= 2 && <ViewPager>{items}</ViewPager>}
{count >= 2 && (
<ViewPager itemWidth={viewPagerItemWidth}>{items}</ViewPager>
)}
</>
)}
</Host>
Expand Down
11 changes: 7 additions & 4 deletions apps/native/app/src/screens/home/vehicles-module.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,22 @@ const VehiclesModule = React.memo(
return null
}

const viewPagerItemWidth = screenWidth - theme.spacing[2] * 3
const count = reorderedVehicles?.length ?? 0

const items = reorderedVehicles?.slice(0, 3).map((vehicle, index) => (
<VehicleItem
key={vehicle.permno}
item={vehicle}
index={index}
minHeight={176}
minHeight={152}
style={
count > 1
? {
width: screenWidth - theme.spacing[2] * 3,
width: viewPagerItemWidth,
paddingHorizontal: 0,
paddingLeft: theme.spacing[2],
minHeight: 176,
minHeight: 152,
}
: {
width: '100%',
Expand Down Expand Up @@ -158,7 +159,9 @@ const VehiclesModule = React.memo(
/>
)}
{count === 1 && items}
{count >= 2 && <ViewPager>{items}</ViewPager>}
{count >= 2 && (
<ViewPager itemWidth={viewPagerItemWidth}>{items}</ViewPager>
)}
</>
)}
</Host>
Expand Down
15 changes: 8 additions & 7 deletions apps/native/app/src/screens/vehicles/components/vehicle-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Label, VehicleCard } from '@ui'
import React from 'react'
import { FormattedDate, FormattedMessage } from 'react-intl'
import { SafeAreaView, TouchableHighlight, View, ViewStyle } from 'react-native'
import { useTheme } from 'styled-components/native'
import styled, { useTheme } from 'styled-components/native'
import { ListVehiclesQuery } from '../../../graphql/types/schema'
import { navigateTo } from '../../../lib/deep-linking'

Expand All @@ -14,6 +14,11 @@ type VehicleListItem = NonNullable<
NonNullable<ListVehiclesQuery['vehiclesList']>['vehicleList']
>[0]

const Cell = styled(TouchableHighlight)`
margin-bottom: ${({ theme }) => theme.spacing[2]};
border-radius: ${({ theme }) => theme.border.radius.extraLarge};
`

export const VehicleItem = React.memo(
({
item,
Expand All @@ -39,14 +44,10 @@ export const VehicleItem = React.memo(

return (
<View style={{ paddingHorizontal: theme.spacing[2], ...style }}>
<TouchableHighlight
<Cell
underlayColor={
theme.isDark ? theme.shades.dark.shade100 : theme.color.blue100
}
style={{
marginBottom: theme.spacing[2],
borderRadius: theme.border.radius.extraLarge,
}}
onPress={() => {
navigateTo(`/vehicle/`, {
id: item.permno,
Expand Down Expand Up @@ -78,7 +79,7 @@ export const VehicleItem = React.memo(
}
/>
</SafeAreaView>
</TouchableHighlight>
</Cell>
</View>
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export const VehicleMileageScreen: NavigationFunctionComponent<{
}, [res.data, res.loading])

const latestMileage =
data?.[0]?.__typename !== 'Skeleton' && data[0].mileage
data?.[0]?.__typename !== 'Skeleton' && data[0]?.mileage
? // Parse mileage from string to number
+data[0].mileage
: 0
Expand Down
8 changes: 7 additions & 1 deletion apps/native/app/src/ui/lib/card/vehicle-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ export function VehicleCard({
return (
<Host minHeight={minHeight}>
<Content>
<Title variant="heading4">{title}</Title>
<Title
variant="heading4"
numberOfLines={minHeight ? 1 : undefined}
ellipsizeMode="tail"
>
{title}
</Title>
<Text>
{color} - {number}
</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const GeneralCardSkeleton = ({ height }: { height: number }) => {
overlayOpacity={1}
height={height}
style={{
borderRadius: theme.spacing[2],
borderRadius: 16,
marginBottom: theme.spacing[2],
}}
/>
Expand Down
4 changes: 2 additions & 2 deletions apps/native/app/src/ui/lib/view-pager/view-pager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ export function ViewPager({ children, itemWidth }: ViewPagerProps) {
contentWidth - OFFSET - OFFSET_CARD,
contentWidth - OFFSET - 60,
contentWidth - 120,
]
].sort((a, b) => a - b) // Make sure inputRange is non-decreasing to prevent crash
: [
OFFSET * i - OFFSET,
OFFSET * i,
i === pages - 2 ? contentWidth - OFFSET - 60 : OFFSET * i + OFFSET,
]
].sort((a, b) => a - b) // Make sure inputRange is non-decreasing to prevent crash

const x = useRef(new Animated.Value(0)).current

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,15 @@ export const sakHeaderGridContainer = style({
},
}),
})

export const landlaeknirHeaderGridContainer = style({
display: 'grid',
maxWidth: '1342px',
margin: '0 auto',
...themeUtils.responsiveStyle({
lg: {
gridTemplateRows: '315px',
gridTemplateColumns: '60fr 40fr',
},
}),
})
11 changes: 10 additions & 1 deletion apps/web/components/Organization/Wrapper/OrganizationWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,16 @@ export const OrganizationHeader: React.FC<
/>
)
case 'landlaeknir':
return (
return n('usingDefaultHeader', false) ? (
<DefaultHeader
{...defaultProps}
image={n(
'landlaeknirHeaderImage',
'https://images.ctfassets.net/8k0h54kbe6bj/2p6UWMBdVkVHBAjsnX20bY/c04b402332dbae96c198db7b8640f20b/Header_illustration_1.svg',
)}
className={styles.landlaeknirHeaderGridContainer}
/>
) : (
<LandlaeknirHeader
organizationPage={organizationPage}
logoAltText={logoAltText}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const Done: Form = buildForm({
buildMessageWithLinkButtonField({
id: 'done.goToServicePortal',
title: '',
url: '/minarsidur/min-gogn/listar/medmaelasofnun',
url: '/minarsidur/min-gogn/listar/althingis-medmaelasofnun',
buttonTitle: m.linkFieldButtonTitle,
message: m.linkFieldMessage,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const Done: Form = buildForm({
buildMessageWithLinkButtonField({
id: 'done.goToServicePortal',
title: '',
url: '/minarsidur/min-gogn/listar/medmaelasofnun',
url: '/minarsidur/min-gogn/listar/althingis-medmaelasofnun',
buttonTitle: m.linkFieldButtonTitle,
message: m.linkFieldMessage,
}),
Expand Down
12 changes: 6 additions & 6 deletions libs/auth-api-lib/src/lib/clients/clients.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ export class ClientsService {
private readonly clientDelegationType: typeof ClientDelegationType,
@InjectModel(ClientPostLogoutRedirectUri)
private clientPostLogoutUri: typeof ClientPostLogoutRedirectUri,

private readonly clientsTranslationService: ClientsTranslationService,

@Inject(LOGGER_PROVIDER)
private logger: Logger,
) {}
Expand Down Expand Up @@ -606,10 +604,12 @@ export class ClientsService {
) {
await this.clientModel.update(
{
supportsCustomDelegation,
supportsLegalGuardians,
supportsProcuringHolders,
supportsPersonalRepresentatives,
...(supportsLegalGuardians ? { supportsLegalGuardians } : {}),
...(supportsPersonalRepresentatives
? { supportsPersonalRepresentatives }
: {}),
...(supportsProcuringHolders ? { supportsProcuringHolders } : {}),
...(supportsCustomDelegation ? { supportsCustomDelegation } : {}),
},
{
...options,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const OrganDonation = () => {
title={formatMessage(m.organDonation)}
intro={formatMessage(m.organDonationDescription)}
/>
<Box>
<Box marginBottom={6}>
<LinkResolver
href={formatMessage(m.organDonationLink)}
key="organ-donation"
Expand All @@ -53,12 +53,7 @@ const OrganDonation = () => {
)}
{!error && !loading && donorStatus !== null && (
<Box>
<Text
variant="eyebrow"
color="purple400"
marginTop={5}
marginBottom={1}
>
<Text variant="eyebrow" color="purple400" marginBottom={1}>
{formatMessage(m.takeOnOrganDonation)}
</Text>
<ActionCard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export const GetCurrentCollection = gql`
startTime
name
isActive
isPresidential
status
areas {
id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ const Signees = () => {
useNamespaces('sp.signatureCollection')
const { formatMessage } = useLocale()
const { pathname } = useLocation()
const listId = pathname.replace('/min-gogn/listar/medmaelasofnun/', '')
const listId = pathname.replace(
'/min-gogn/listar/althingis-medmaelasofnun/',
'',
)

const [searchTerm, setSearchTerm] = useState('')
const { listSignees, loadingSignees } = useGetListSignees(listId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,25 @@ import { useLocale } from '@island.is/localization'
import { m } from '../../../lib/messages'
import AddConstituency from './modals/AddConstituency'
import DeletePerson from './modals/DeletePerson'
import {
useGetListsForOwner,
useGetListsForUser,
useIsOwner,
} from '../../../hooks'
import { useAuth } from '@island.is/auth/react'
import { SignatureCollection } from '@island.is/api/schema'

const OwnerView = () => {
const OwnerView = ({
currentCollection,
}: {
currentCollection: SignatureCollection
}) => {
const navigate = useNavigate()
const { formatMessage } = useLocale()
const { userInfo: user } = useAuth()
const { listsForOwner, loadingOwnerLists } = useGetListsForOwner(
currentCollection?.id || '',
)

return (
<Stack space={8}>
Expand Down
Loading

0 comments on commit c268b2b

Please sign in to comment.