Skip to content

Commit

Permalink
fix: 🐛 merge
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorlarsson committed Nov 27, 2021
2 parents 6498657 + 557d6d5 commit d26fd62
Show file tree
Hide file tree
Showing 57 changed files with 1,088 additions and 202 deletions.
90 changes: 45 additions & 45 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
# name: Release

# on:
# push:
# branches:
# - main

# jobs:
# build:

# runs-on: ubuntu-latest

# steps:
# - name: Checkout code
# uses: actions/checkout@v2

# - name: Setup Node
# uses: actions/setup-node@v1
# with:
# node-version: '14.17.6'

# - name: Setup timezone
# uses: zcong1993/setup-timezone@master
# with:
# timezone: Europe/Stockholm

# - name: Install dependencies
# run: npx lerna bootstrap

# - name: Run linting and tests
# run: |
# yarn lint
# yarn test
# env:
# CI: true

# - name: Create release using semantic-release
# uses: cycjimmy/semantic-release-action@v2
# with:
# semantic_version: 17.1.1
# extra_plugins: |
# @semantic-release/changelog@5.0.1
# @semantic-release/git@9.0
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Release

on:
push:
branches:
- main

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '14.17.6'

- name: Setup timezone
uses: zcong1993/setup-timezone@master
with:
timezone: Europe/Stockholm

- name: Install dependencies
run: yarn

- name: Run linting and tests
run: |
yarn lint
yarn test
env:
CI: true

- name: Create release using semantic-release
uses: cycjimmy/semantic-release-action@v2
with:
semantic_version: 17.1.1
extra_plugins: |
@semantic-release/changelog@5.0.1
@semantic-release/git@9.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
## [2.2.1](https://github.com/kolplattformen/skolplattformen/compare/v2.2.0...v2.2.1) (2021-11-23)


### Bug Fixes

* 🐛 spelling of chinese traditional in chinese traditional ([a28fd97](https://github.com/kolplattformen/skolplattformen/commit/a28fd97fe7907a591dc92f5ddeccf1045b4f794b))

# [2.2.0](https://github.com/kolplattformen/skolplattformen/compare/v2.1.0...v2.2.0) (2021-11-23)


### Bug Fixes

* 🐛 Add languages to curriculum config ([b9302f9](https://github.com/kolplattformen/skolplattformen/commit/b9302f96faaf71c797ec335018d9952e26e9d267))
* 🐛 Clarify who's personal identity number to enter ([5028a85](https://github.com/kolplattformen/skolplattformen/commit/5028a85824f4d73ab8007caaeca32a439f4f360e)), closes [#526](https://github.com/kolplattformen/skolplattformen/issues/526)
* 🐛 fix crash when moment locale and language code differ ([623bf48](https://github.com/kolplattformen/skolplattformen/commit/623bf483b52a54a6199e6607248b948b775b6e7b))
* 🐛 Fixes crash when body od newItem is empty ([3e0fd14](https://github.com/kolplattformen/skolplattformen/commit/3e0fd1474a719382627270a1305110692f9ff99b))
* 🐛 Fixes failing tests (added skip), fixes lint + test ([d71c106](https://github.com/kolplattformen/skolplattformen/commit/d71c10607f6a4b89b582b81258fc9c0fc20bf2a8))
* 🐛 Fixes merge with main ([c54f2ff](https://github.com/kolplattformen/skolplattformen/commit/c54f2ffd05589ffbebba5e50b9aef4649bfa9b58))
* 🐛 Fixes tests ([d451cf1](https://github.com/kolplattformen/skolplattformen/commit/d451cf13afbf5e4d1fca43c45d3938d11503d394))
* 🐛 Upgraded async-storage from 1.5.2 to 1.5.9 ([0cd72f5](https://github.com/kolplattformen/skolplattformen/commit/0cd72f5d84bd76b846d99ac7995eba3bec154866))
* add missing package references ([d41e2e3](https://github.com/kolplattformen/skolplattformen/commit/d41e2e3efe278415f3afc462b721afbec4b6f1e2))
* failing html parsing ([2a2259a](https://github.com/kolplattformen/skolplattformen/commit/2a2259a2608ef7e9420d9d3fa59f55530d662ae9))
* images cropping on different devices ([#524](https://github.com/kolplattformen/skolplattformen/issues/524)) ([7c50988](https://github.com/kolplattformen/skolplattformen/commit/7c5098859b71f13ffdb9441b81e149b983355d9f))
* licenses extractor is used on the correct package.json ([d1de447](https://github.com/kolplattformen/skolplattformen/commit/d1de44775b9df6132af9974f6aaef09c5f2d678f))
* lint and prettier fixes ([169b536](https://github.com/kolplattformen/skolplattformen/commit/169b5365e94cd0ff5fe2aa9f28a7baebaeba899a))
* package.json name for app changed ([a867b11](https://github.com/kolplattformen/skolplattformen/commit/a867b116c802956b5f5a8b6ec55e64e6821eb475))
* remove unused e2e files ([97b4380](https://github.com/kolplattformen/skolplattformen/commit/97b438069a589abc37a96fe8c10ce23078b30e7b))
* rename and fix imports ([18ed862](https://github.com/kolplattformen/skolplattformen/commit/18ed8620af5b396eeed740058531ebafda4f8d64))
* some failing tests in hooks now works ([c122f28](https://github.com/kolplattformen/skolplattformen/commit/c122f281a9607d7a52b3a25718e93151ddd7768a))
* ui-kitten metro config ([5fdc3d7](https://github.com/kolplattformen/skolplattformen/commit/5fdc3d71adb8d9364c8c6b345de841f0f3f1de7c))
* update github workflow to run nx instead of lerna ([289c2f8](https://github.com/kolplattformen/skolplattformen/commit/289c2f848aec44da03692d4119aa9e1544dc9292))


### Features

* 🎸 activate norwegian ([cec7ddd](https://github.com/kolplattformen/skolplattformen/commit/cec7ddd8601309f752f9fe49298fcc96643599b7))
* 🎸 bump to version 2.0.4 ([6d762e7](https://github.com/kolplattformen/skolplattformen/commit/6d762e70076c292d952f1b626ea2925caaac78f9))
* 🎸 bump to version 2.0.4 ([078c946](https://github.com/kolplattformen/skolplattformen/commit/078c946a441a4227033c24acbb17807ea19a4dae))
* 🎸 Chinese (simplified and traditional) ([eed2a75](https://github.com/kolplattformen/skolplattformen/commit/eed2a7579c23629c0e8dbd8350fa971cec3753fb))
* 🎸 Japanese ([e5deadd](https://github.com/kolplattformen/skolplattformen/commit/e5deadd88084fba26a7b8dbc83664be376b76a51))
* 🎸 language updates for curriculum ([4d62d9e](https://github.com/kolplattformen/skolplattformen/commit/4d62d9e26987ae4840f81e1c1ad958a6905746c0))
* 🎸 Latin and fix for locales ([1c05196](https://github.com/kolplattformen/skolplattformen/commit/1c051961d695ebb2546f2a30991d01015e7c48fb))
* 🎸 Portuguese ([2f45cbd](https://github.com/kolplattformen/skolplattformen/commit/2f45cbdeb639cd43c6b13cff0a2f86a934b950dd))
* 🎸 Somali ([df8f2e3](https://github.com/kolplattformen/skolplattformen/commit/df8f2e378e76d1f4b8f4b0cfd55aba82626ccaa8))
* add nx build system ([d90cfd2](https://github.com/kolplattformen/skolplattformen/commit/d90cfd2a3b94b9845f809b65a96a72b10447651c))

# [2.1.0](https://github.com/kolplattformen/skolplattformen/compare/v2.0.0...v2.1.0) (2021-10-04)


Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ If you're offended by this initiative, rest assured there is no reason to be —
- [Viktor Sarström](https://github.com/viktorlarsson)
- [Andreas Eriksson](https://github.com/whyer)
- [Kajetan Kazimierczak](https://github.com/kajetan-kazimierczak)
- [Karin Nygårds (artwork)](https://github.com/grishund)
- You?

## License
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ test('displays address of guardian', () => {

fireEvent.press(screen.getByTestId('ShowContactInfoButton'))

fireEvent.press(screen.getByText(/hem/i))
fireEvent.press(screen.getByText(/adress/i))
expect(Linking.openURL).toHaveBeenCalledWith(
'http://maps.apple.com/?daddr=Testgatan'
)
Expand Down
5 changes: 2 additions & 3 deletions apps/skolplattformen-sthlm/components/absence.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { defaultStackStyling } from '../design/navigationThemes'
import usePersonalStorage from '../hooks/usePersonalStorage'
import { Layout as LayoutStyle, Sizing, Typography } from '../styles'
import { studentName } from '../utils/peopleHelpers'
// @ts-expect-error Fix when migrating to TSX
import { useSMS } from '../utils/SMS'
import { translate } from '../utils/translation'
import { AlertIcon } from './icon.component'
Expand Down Expand Up @@ -139,7 +138,7 @@ const Absence = () => {
<View style={styles.wrap}>
<View style={styles.field}>
<Text style={styles.label}>
{translate('general.socialSecurityNumber')}
{translate('abscense.childsPersonalNumber')}
</Text>
<Input
testID="personalIdentityNumberInput"
Expand Down Expand Up @@ -240,7 +239,7 @@ const Absence = () => {
</View>
</View>
)}
<Button onPress={handleSubmit} status="primary">
<Button onPress={() => handleSubmit()} status="primary">
{translate('general.send')}
</Button>
</View>
Expand Down
1 change: 0 additions & 1 deletion apps/skolplattformen-sthlm/components/auth.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const randomWord = (
const randomIndex: number = Math.floor(Math.random() * keys.length)
const argumentKey: string = keys[randomIndex]

// @ts-expect-error Fix this later
return words[argumentKey]
}

Expand Down
2 changes: 2 additions & 0 deletions apps/skolplattformen-sthlm/components/child.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ const getRouteTitleFromName = (routeName: string) => {
return translate('navigation.menu')
case 'Classmates':
return translate('navigation.classmates')
default:
return ''
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const Classmates = () => {
const renderItemIcon = (props: IconProps) => (
<Icon {...props} name="people-outline" />
)
const [selected, setSelected] = React.useState()
const [selected, setSelected] = React.useState<Classmate>()
const renderItem = ({ item, index }: ListRenderItemInfo<Classmate>) => (
<ListItem
accessibilityLabel={`${translate('classmates.child')} ${index + 1}`}
Expand All @@ -41,7 +41,7 @@ export const Classmates = () => {
<ContactMenu
contact={item}
selected={item === selected}
setSelected={setSelected}
setSelected={() => setSelected(undefined)}
/>
)}
/>
Expand Down
99 changes: 84 additions & 15 deletions apps/skolplattformen-sthlm/components/image.component.tsx
Original file line number Diff line number Diff line change
@@ -1,39 +1,108 @@
import { useApi } from '@skolplattformen/hooks'
import React, { useEffect, useState } from 'react'
import { Image as ImageBase, ImageStyle, StyleProp } from 'react-native'
import React, { useCallback, useEffect, useState } from 'react'
import {
Image as ImageBase,
ImageResizeMode,
ImageStyle,
StyleProp,
useWindowDimensions,
View,
} from 'react-native'

interface ImageProps {
src: string
style: StyleProp<ImageStyle>
/**
* Width of component. Defaults to window width
* Used to automatically calculate width
*/
componentWidth?: number
accessibilityIgnoresInvertColors: boolean
resizeMode?: ImageResizeMode
width?: number
height?: number
}

export const Image = ({
src,
style,
componentWidth = 0,
accessibilityIgnoresInvertColors,
resizeMode = 'contain',
}: ImageProps) => {
const { api } = useApi()
const [headers, setHeaders] = useState()
const { width: windowWidth } = useWindowDimensions()
const [dimensions, setDimensions] = useState({ width: 0, height: 0 })

const getHeaders = async (url: string) => {
const { headers: newHeaders } = await api.getSession(url)
setHeaders(newHeaders)
}
const debugImageName = getDebugImageName(src)

const prefetchImageInformation = useCallback(
async (url: string) => {
if (!url) return
const { headers: newHeaders } = await api.getSession(url)

console.log('[IMAGE] Getting image dimensions with headers', {
debugImageName,
newHeaders,
})

ImageBase.getSizeWithHeaders(
url,
newHeaders,
(w, h) => {
console.log('[IMAGE] Received image dimensions', {
debugImageName,
w,
h,
})
setDimensions({ width: w, height: h })
setHeaders(newHeaders)
},
(error) => {
console.error('[Image] Failed to get image dimensions', {
debugImageName,
error,
})
}
)
},
[api, debugImageName]
)

useEffect(() => {
getHeaders(src)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [src])
prefetchImageInformation(src)
}, [prefetchImageInformation, src])

const compWidth = componentWidth || windowWidth

return headers ? (
const scale = compWidth / dimensions.width
const scaledWidth = Math.round(dimensions.width * scale)
const scaledHeight = Math.round(dimensions.height * scale)

const imageSource =
resizeMode === 'cover'
? { uri: src, headers }
: { uri: src, headers, height: scaledHeight, width: scaledWidth }

return headers && scaledWidth && scaledHeight ? (
<ImageBase
accessibilityIgnoresInvertColors={accessibilityIgnoresInvertColors}
source={{
uri: src,
headers,
}}
source={imageSource}
resizeMode={resizeMode}
style={style}
/>
) : null
) : (
<View style={style} />
)
}

const getDebugImageName = (src: string) => {
try {
const split = src.split('/')
return split[split.length - 1]
} catch (e: any) {
console.log('FAILED', e.message)
return null
}
}
8 changes: 6 additions & 2 deletions apps/skolplattformen-sthlm/components/markdown.component.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Text } from '@ui-kitten/components'
import React from 'react'
import { Linking, StyleSheet } from 'react-native'
import { Dimensions, Linking, StyleSheet } from 'react-native'
import MarkdownBase, { RenderRules } from 'react-native-markdown-display'
import { Sizing } from '../styles'
import { Image } from './image.component'

interface MarkdownProps {
Expand All @@ -20,6 +21,9 @@ const rules: RenderRules = {
accessibilityIgnoresInvertColors
key={src}
src={url}
// TODO: Sizing.t5 should not be hardcoded here...
// Maybe measure the width from inside the component instead?
componentWidth={Dimensions.get('window').width - Sizing.t5 * 2}
style={styles.markdownImage}
/>
)
Expand Down Expand Up @@ -52,5 +56,5 @@ export const Markdown = ({ style, children }: MarkdownProps) => {
}

const styles = StyleSheet.create({
markdownImage: { width: '100%', minHeight: 300 },
markdownImage: { width: '100%', borderRadius: 15 },
})
7 changes: 3 additions & 4 deletions apps/skolplattformen-sthlm/components/newsItem.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { StyleService, Text, useStyleSheet } from '@ui-kitten/components'
import moment from 'moment'
import 'moment/locale/sv'
import React from 'react'
import { ScrollView, View } from 'react-native'
import { Dimensions, ImageStyle, ScrollView, View } from 'react-native'
import { NativeStackNavigationOptions } from 'react-native-screens/native-stack'
import { defaultStackStyling } from '../design/navigationThemes'
import { Layout, Sizing, Typography } from '../styles'
Expand Down Expand Up @@ -79,8 +79,8 @@ export const NewsItem = ({ route }: NewsItemProps) => {
<Image
accessibilityIgnoresInvertColors={false}
src={newsItem.fullImageUrl}
// @ts-expect-error Fix later on
style={styles.image}
style={styles.image as ImageStyle}
componentWidth={Dimensions.get('screen').width - Sizing.t5 * 2}
/>
)}
</View>
Expand Down Expand Up @@ -119,7 +119,6 @@ const themedStyles = StyleService.create({
},
image: {
width: '100%',
minHeight: 300,
marginTop: Sizing.t4,
borderRadius: 15,
},
Expand Down
Loading

0 comments on commit d26fd62

Please sign in to comment.