diff --git a/packages/Upphandling/api/companies.js b/packages/Upphandling/api/companies.js index 972af86..8b0596e 100644 --- a/packages/Upphandling/api/companies.js +++ b/packages/Upphandling/api/companies.js @@ -1,15 +1,15 @@ -import axios from 'axios' +import {get} from 'axios' export const getCompanies = async () => { - const { data } = await axios.get('https://api.upphandling.app/companies') + const { data } = await get('https://api.upphandling.app/companies') return data } export const getCompanyFromId = async (id) => { - const { data } = await axios.get(`https://api.upphandling.app/companies/${id}`) + const { data } = await get(`https://api.upphandling.app/companies/${id}`) return data } export const createCompany = async (company) => { - const { data } = await axios.post('https://api.upphandling.app/companies', company) + const { data } = await post('https://api.upphandling.app/companies', company) return data } \ No newline at end of file diff --git a/packages/Upphandling/api/dis.js b/packages/Upphandling/api/dis.js index 03ca627..9badefe 100644 --- a/packages/Upphandling/api/dis.js +++ b/packages/Upphandling/api/dis.js @@ -1,15 +1,15 @@ -import axios from 'axios' +import {get, post} from 'axios' export const getDis = async () => { - const { data } = await axios.get('https://api.upphandling.app/dis') + const { data } = await get('https://api.upphandling.app/dis') return data } export const getDisById = async (id) => { - const { data } = await axios.get(`https://api.upphandling.app/dis/${id}`) + const { data } = await get(`https://api.upphandling.app/dis/${id}`) return data } export const createDis = (dis) => { console.log('Creating dis...', dis) - return axios.post('https://api.upphandling.app/dis', dis) + return post('https://api.upphandling.app/dis', dis) } \ No newline at end of file diff --git a/packages/Upphandling/api/github.js b/packages/Upphandling/api/github.js index f13dd02..22b557a 100644 --- a/packages/Upphandling/api/github.js +++ b/packages/Upphandling/api/github.js @@ -1,8 +1,8 @@ -import axios from 'axios' +import {get} from 'axios' // return issues for a repo export const getIssues = async (owner, repo) => { console.log('owner', owner, 'repo', repo) - const { data } = await axios.get(`https://api.github.com/repos/${owner}/${repo}/issues`, { + const { data } = await get(`https://api.github.com/repos/${owner}/${repo}/issues`, { headers: { //Authorization: `token ${process.env.REACT_APP_GITHUB_TOKEN}`, Accept: 'application/vnd.github.v3+json' diff --git a/packages/Upphandling/api/offer.js b/packages/Upphandling/api/offer.js new file mode 100644 index 0000000..a98ea97 --- /dev/null +++ b/packages/Upphandling/api/offer.js @@ -0,0 +1,6 @@ +import axios from 'axios' + +export const createOffer = async ({offer}) => { + const { data } = await axios.post(`https://api.upphandling.app/offers`, offer) + return data +} \ No newline at end of file diff --git a/packages/Upphandling/api/offers.js b/packages/Upphandling/api/offers.js index 6cbce8c..1c20b38 100644 --- a/packages/Upphandling/api/offers.js +++ b/packages/Upphandling/api/offers.js @@ -1,9 +1,9 @@ -import axios from 'axios' +import {get, post} from 'axios' export const getOffers = async () => { - const { data } = await axios.get('https://api.upphandling.app/offers') + const { data } = await get('https://api.upphandling.app/offers') return data } export const createOffer = (offer) => { - return axios.post('https://api.upphandling.app/offers', offer) + return post('https://api.upphandling.app/offers', offer) } \ No newline at end of file diff --git a/packages/Upphandling/api/participation.js b/packages/Upphandling/api/participation.js index a797c09..37ab119 100644 --- a/packages/Upphandling/api/participation.js +++ b/packages/Upphandling/api/participation.js @@ -1,10 +1,10 @@ -import axios from 'axios' +import {get, post} from 'axios' export const getParticipations = async (disId) => { - const { data } = await axios.get(`https://api.upphandling.app/dis/${disId}/companies`) + const { data } = await get(`https://api.upphandling.app/dis/${disId}/companies`) return data } export const createParticipation = async ({disId, companyId}) => { - const { data } = await axios.post(`https://api.upphandling.app/participations`, {disId, companyId}) + const { data } = await post(`https://api.upphandling.app/participations`, {disId, companyId}) return data } \ No newline at end of file diff --git a/packages/Upphandling/api/tenders.js b/packages/Upphandling/api/tenders.js index 8a797a0..090319b 100644 --- a/packages/Upphandling/api/tenders.js +++ b/packages/Upphandling/api/tenders.js @@ -1,13 +1,19 @@ -import axios from 'axios' +import {get, post} from 'axios' -export const getTenders = async () => { - const { data } = await axios.get('https://api.upphandling.app/tenders') +export const getTenders = async (disId) => { + const { data } = await get(`https://api.upphandling.app/dis/${disId}/tenders`) return data } +export const getTender = async (tenderId) => { + const { data } = await get(`https://api.upphandling.app/tenders/${tenderId}`) + return data +} + + export const createTender = async (tender) => { console.log('creating tender', JSON.stringify(tender, null, 2)) - const { data } = await axios.post('https://api.upphandling.app/tenders', tender).catch((error) => { + const { data } = await post('https://api.upphandling.app/tenders', tender).catch((error) => { console.log('error', JSON.stringify(error)) throw error }) diff --git a/packages/Upphandling/assets/background.png b/packages/Upphandling/assets/background.png new file mode 100644 index 0000000..cb937df Binary files /dev/null and b/packages/Upphandling/assets/background.png differ diff --git a/packages/Upphandling/assets/toggle-dynamic-clay.png b/packages/Upphandling/assets/toggle-dynamic-clay.png new file mode 100644 index 0000000..44b2b03 Binary files /dev/null and b/packages/Upphandling/assets/toggle-dynamic-clay.png differ diff --git a/packages/Upphandling/assets/toggle-dynamic-color.png b/packages/Upphandling/assets/toggle-dynamic-color.png new file mode 100644 index 0000000..5b4c974 Binary files /dev/null and b/packages/Upphandling/assets/toggle-dynamic-color.png differ diff --git a/packages/Upphandling/assets/toggle-dynamic-gradient.png b/packages/Upphandling/assets/toggle-dynamic-gradient.png new file mode 100644 index 0000000..b3f44e7 Binary files /dev/null and b/packages/Upphandling/assets/toggle-dynamic-gradient.png differ diff --git a/packages/Upphandling/assets/toggle-dynamic-premium.png b/packages/Upphandling/assets/toggle-dynamic-premium.png new file mode 100644 index 0000000..d2764dc Binary files /dev/null and b/packages/Upphandling/assets/toggle-dynamic-premium.png differ diff --git a/packages/Upphandling/components/CompanyDetails.js b/packages/Upphandling/components/CompanyDetails.js index bf9647d..1c58d04 100644 --- a/packages/Upphandling/components/CompanyDetails.js +++ b/packages/Upphandling/components/CompanyDetails.js @@ -1,88 +1,70 @@ import React from 'react' import {StyleSheet, View} from 'react-native' -import {Text} from '@ui-kitten/components' +import {Card, Text} from '@ui-kitten/components' import { Field } from './Field' export const CompanyDetails = ({company}) => ( - + - Företagsinformation + {company?.name} - - {company.country ? ( ) : null} - + ) diff --git a/packages/Upphandling/components/Field.js b/packages/Upphandling/components/Field.js index 753a048..7f55da6 100644 --- a/packages/Upphandling/components/Field.js +++ b/packages/Upphandling/components/Field.js @@ -2,7 +2,7 @@ import React from 'react' import { StyleSheet } from 'react-native' import { Divider, Layout, Text } from '@ui-kitten/components' -export const Field = ({style, label, value, ...layoutProps}) => { +export const Field = ({style, label, children, value, ...layoutProps}) => { return ( @@ -10,7 +10,7 @@ export const Field = ({style, label, value, ...layoutProps}) => { {label} - {value} + {value}{children} @@ -19,6 +19,7 @@ export const Field = ({style, label, value, ...layoutProps}) => { const styles = StyleSheet.create({ container: { + padding: 16, flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', diff --git a/packages/Upphandling/components/Hero.js b/packages/Upphandling/components/Hero.js new file mode 100644 index 0000000..95d578c --- /dev/null +++ b/packages/Upphandling/components/Hero.js @@ -0,0 +1,132 @@ +import { ImageOverlay } from '../components/ImageOverlay' +import React from 'react' +import serviceIcons from '../data/services.json' +import { ScrollView, View } from 'react-native' +import moment from 'moment' +import 'moment/locale/sv' +moment.locale('sv') + +import { + Button, + Card, + StyleService, + Text, + useStyleSheet, +} from '@ui-kitten/components' + +const tagIcon = (style, icon) => + +const tag = (service, index) => ( + +) + +const footer = (services, technologies) => ( + + {services?.map(tag)} + + {technologies?.map(renderDetailItem)} + + +) + +export const Hero = ({ + image, + title, + organisation, + status, + startDate, + services, + technologies, + onPress, +}) => { + return ( + <> + + footer(services, technologies)} + > + + {title} + + + {organisation} + + + {status} + + {startDate && ( + + {moment(startDate).format('YYYY-MM-DD')} ( + {moment().to(moment(startDate))}) + + )} + {onPress && ( + + )} + + + ) +} + +const styles = StyleService.create({ + image: { + marginTop: -130, + height: 260, + }, + bookingCard: { + marginTop: -80, + margin: 16, + borderRadius: 20, + }, + title: { + width: '80%', + }, + dateLabel: { + marginTop: 8, + }, + footerLabel: { + marginBottom: 16, + color: '#333', + }, + label: { + marginTop: 8, + }, + ctaButton: { + position: 'absolute', + bottom: 24, + right: 24, + }, + detailsList: { + flexDirection: 'row', + marginHorizontal: -4, + marginVertical: 8, + }, + detailItem: { + marginHorizontal: 4, + borderRadius: 16, + }, + optionList: { + flexDirection: 'row', + marginVertical: 8, + }, + optionItem: { + marginHorizontal: 4, + paddingHorizontal: 0, + }, +}) diff --git a/packages/Upphandling/components/ImageOverlay.js b/packages/Upphandling/components/ImageOverlay.js index c1bc140..1c39825 100644 --- a/packages/Upphandling/components/ImageOverlay.js +++ b/packages/Upphandling/components/ImageOverlay.js @@ -1,20 +1,28 @@ import React from 'react' -import {ImageBackground, StyleSheet, View} from 'react-native' +import { ImageBackground, StyleSheet, View } from 'react-native' +import { TouchableOpacity } from 'react-native-gesture-handler' const DEFAULT_OVERLAY_COLOR = 'rgba(53,34,171,0.4)' -export const ImageOverlay = ({style, children, ...imageBackgroundProps}) => { - const {overlayColor, ...imageBackgroundStyle} = StyleSheet.flatten(style) +export const ImageOverlay = ({ + style, + children, + onPress, + ...imageBackgroundProps +}) => { + const { overlayColor, ...imageBackgroundStyle } = StyleSheet.flatten(style) return ( - - - {children} - + + + + {children} + + ) } diff --git a/packages/Upphandling/components/Issues.js b/packages/Upphandling/components/Issues.js index de47508..24bda6d 100644 --- a/packages/Upphandling/components/Issues.js +++ b/packages/Upphandling/components/Issues.js @@ -9,17 +9,7 @@ import React from 'react' import { View } from 'react-native' import { useIssues } from '../hooks/useGithub' import { ImageOverlay } from './ImageOverlay' - -const tag = (label, index) => ( - -) +import { Tag } from './Tag' export const Issues = ({ url, selected, onSelectedChange }) => { if (!url) return No repo @@ -53,7 +43,7 @@ export const Issues = ({ url, selected, onSelectedChange }) => { return ( {data.map((issue) => ( - + toggle(issue, checked) }/> @@ -63,7 +53,7 @@ export const Issues = ({ url, selected, onSelectedChange }) => { {issue.body} - {issue.labels.map((label, index) => tag(label, index))} + {issue.labels.map((label, index) => {label.name})} @@ -93,7 +83,6 @@ const styles = StyleService.create({ borderRadius: 16, }, body: { - overflow: '', maxHeight: 100, }, }) diff --git a/packages/Upphandling/components/OrderList.js b/packages/Upphandling/components/OrderList.js new file mode 100644 index 0000000..e4cbb23 --- /dev/null +++ b/packages/Upphandling/components/OrderList.js @@ -0,0 +1,68 @@ +import React, { useState } from 'react' +import { Text, View, StyleSheet, TouchableOpacity } from 'react-native' +import DraggableFlatList, { + ScaleDecorator, +} from 'react-native-draggable-flatlist' + +const NUM_ITEMS = 10 +function getColor(i) { + const multiplier = 255 / (NUM_ITEMS - 1) + const colorVal = i * multiplier + return `rgb(${colorVal}, ${Math.abs(128 - colorVal)}, ${255 - colorVal})` +} + + +const initialData = [...Array(NUM_ITEMS)].map((d, index) => { + const backgroundColor = getColor(index) + return { + key: `item-${index}`, + label: String(index) + '', + height: 100, + width: 60 + Math.random() * 40, + backgroundColor, + } +}) + +export default function OrderList({data, onChange}) { + + const renderItem = ({ item, drag, isActive }) => { + return ( + + + {item.label} + + + ) + } + + return ( + onChange(data)} + keyExtractor={(item) => item.key} + renderItem={renderItem} + /> + ) +} + +const styles = StyleSheet.create({ + rowItem: { + height: 100, + width: 100, + alignItems: 'center', + justifyContent: 'center', + }, + text: { + color: 'white', + fontSize: 24, + fontWeight: 'bold', + textAlign: 'center', + }, +}) diff --git a/packages/Upphandling/components/ServicePicker.js b/packages/Upphandling/components/ServicePicker.js index 8ab132e..bf01676 100644 --- a/packages/Upphandling/components/ServicePicker.js +++ b/packages/Upphandling/components/ServicePicker.js @@ -1,4 +1,4 @@ -import React, { useState } from 'react' +import React, { useRef, useState } from 'react' import { Autocomplete, AutocompleteItem, @@ -9,39 +9,40 @@ import { import serviceIcons from '../data/services.json' import { View } from 'react-native' -export const ServicePicker = ({ services, onChange, style }) => { +export const ServicePicker = ({ + services, + placeholder = 'Ange eller välj kompetens', + onChange, + style, +}) => { const [newCompetence, setNewCompetence] = useState() + const [data, setData] = useState(serviceIcons) + + const input = useRef() const onSelect = (index) => { - const selected = Object.keys(serviceIcons)[index] + const selected = Object.keys(data)[index] onChange({ ...services, [selected]: true }) - setNewCompetence('') + onChangeText('') + } + + const onChangeText = (query) => { + setNewCompetence(query) + setData( + Object.entries(serviceIcons) + .filter(([title]) => title.toLowerCase().includes(query.toLowerCase())) + .reduce((result, [title, icon]) => ({...result, [title]: icon }), {}) + ) } - const onBlur = () => { + const add = () => { if (!newCompetence) return onChange({ ...services, [newCompetence]: true }) - setNewCompetence('') + onChangeText('') } return ( <> - - {Object.entries(serviceIcons).map(([title, icon], i) => ( - } - key={i} - title={title} - /> - ))} - {Object.entries(services) .filter(([, val]) => val) @@ -56,8 +57,26 @@ export const ServicePicker = ({ services, onChange, style }) => { ))} - - + (input.current = ref)} + onChangeText={onChangeText} + onPressIn={() => input.current.show()} + accessoryRight={(props) => ( + newCompetence ? add()} name="plus" /> : null + )} + > + {Object.entries(data).map(([title, icon], i) => ( + } + key={i} + title={title} + /> + ))} + ) } @@ -70,8 +89,9 @@ const styles = StyleService.create({ margin: 16, }, gridItem: { - justifyContent:'flex-start', + justifyContent: 'flex-start', marginVertical: 16, minWidth: '40%', + flex: 1, }, }) diff --git a/packages/Upphandling/components/Tag.js b/packages/Upphandling/components/Tag.js new file mode 100644 index 0000000..8c12789 --- /dev/null +++ b/packages/Upphandling/components/Tag.js @@ -0,0 +1,26 @@ +import React from 'react' +import { + Button, + Card, + CheckBox, + StyleService, + Text, +} from '@ui-kitten/components' + +export const Tag = ({children, style}) => ( + +) + + + +const styles = StyleService.create({ + tag: { + borderRadius: 16, + }, +}) diff --git a/packages/Upphandling/components/TechnologyPicker.js b/packages/Upphandling/components/TechnologyPicker.js index 1437841..5e9e523 100644 --- a/packages/Upphandling/components/TechnologyPicker.js +++ b/packages/Upphandling/components/TechnologyPicker.js @@ -1,24 +1,34 @@ -import React, { useState } from 'react' +import React, { useRef, useState } from 'react' import { Autocomplete, AutocompleteItem, + Button, + ButtonGroup, Icon, + Layout, StyleService, - Toggle, + Text, } from '@ui-kitten/components' import technologyIcons from '../data/technologies.json' import { View } from 'react-native' -export const TechnologyPicker = ({ technologies, onChange, style }) => { +const StarIcon = +const BulbIcon = +const RemoveIcon = +const AwardIcon = + +export const TechnologyPicker = ({ technologies, placeholder, onChange, style }) => { const [newCompetence, setNewCompetence] = useState() + const input = useRef() + const onSelect = (index) => { const selected = Object.keys(technologyIcons)[index] onChange({ ...technologies, [selected]: true }) setNewCompetence('') } - const onBlur = () => { + const add = () => { if (!newCompetence) return onChange({ ...technologies, [newCompetence]: true }) setNewCompetence('') @@ -26,13 +36,59 @@ export const TechnologyPicker = ({ technologies, onChange, style }) => { return ( <> + + {Object.entries(technologies) + .filter(([, val]) => val) + .map(([key]) => ( + + {key} + + + + + + + + ))} + ( + newCompetence ? add()} name="plus" /> : null + )} + + ref={(ref) => (input.current = ref)} + onPressIn={() => input.current.show()} onChangeText={setNewCompetence} - onBlur={onBlur} > {Object.entries(technologyIcons).map(([title, icon], i) => ( { /> ))} - - {Object.entries(technologies) - .filter(([, val]) => val) - .map(([key]) => ( - - onChange({ ...technologies, [key]: checked }) - } - > - {key} - - ))} - ) } const styles = StyleService.create({ grid: { - justifyContent: 'space-between', - flexDirection: 'row', - flexWrap: 'wrap', - margin: 16, + flexDirection: 'column', + marginHorizontal: 16, + flex: 1, }, gridItem: { - justifyContent: 'flex-start', - marginVertical: 16, - minWidth: '40%', + marginVertical: 8, + height: 40, }, }) diff --git a/packages/Upphandling/components/Tenders.js b/packages/Upphandling/components/Tenders.js new file mode 100644 index 0000000..49c9127 --- /dev/null +++ b/packages/Upphandling/components/Tenders.js @@ -0,0 +1,116 @@ +import React, { useState } from 'react' +import { ScrollView, View } from 'react-native' +import { + Button, + StyleService, + Text, +} from '@ui-kitten/components' +import { useTenders } from '../hooks/useTenders' +import { ImageOverlay } from './ImageOverlay' +import moment from 'moment' +import { Tag } from './Tag' +import evaluationCriterias from '../data/evaluationCriterias' +import { TouchableOpacity } from 'react-native-gesture-handler' + +const Tender = ({ tender, onPress }) => { + const { + id, + description, + issues, + geography, + services, + technologies, + evaluationCriteria, + startDate, + } = tender + + return ( + + + {description} + + {moment(startDate).calendar()} + + + + {geography} + + + {services.map(s => {s})} + {technologies.map(s => {s})} + + {evaluationCriterias[evaluationCriteria]} + + + + ) +} + +export const Tenders = ({ navigation, tenders }) => { + + if (!tenders) return Laddar... + + const goToTender = (tender) => { + navigation.navigate('OpenTender', { tenderId: tender.id }) + } + + return ( + + {tenders?.map((tender) => ( + goToTender(tender)} /> + ))} + + ) +} + +const styles = StyleService.create({ + image: { + borderRadius: 20, + }, + container: { + flex: 1, + padding: 20, + }, + contentContainer: { + paddingTop: 30, + }, + title: { + marginBottom: 20, + }, + // TODO: fix so it's not taking the whole screen + tenders: { + flex: 1, + flexDirection: 'row', + width: '100%', + }, + tender: { + flex: 1, + width: 300, + backgroundColor: 'rgba(53,34,171,0.4)', + borderRadius: 16, + height: '100%', + padding: 16, + margin: 5, + }, + tenderHeader: { + flexDirection: 'column', + justifyContent: 'space-between', + marginBottom: 20, + }, + tenderBody: { + flex: 5, + flexDirection: 'row', + justifyContent: 'space-between', + }, + icon: { + width: 20, + height: 20, + }, + tag: { + marginRight: 4 + } +}) diff --git a/packages/Upphandling/data/evaluationCriterias.json b/packages/Upphandling/data/evaluationCriterias.json new file mode 100644 index 0000000..994d0ce --- /dev/null +++ b/packages/Upphandling/data/evaluationCriterias.json @@ -0,0 +1,9 @@ +[ + "Pris", + "Erfarenhet av vår bransch/problem", + "Kreativitet / innovation", + "Referenscase", + "Kapacitet", + "Startdatum", + "Kravuppfyllnad" +] diff --git a/packages/Upphandling/data/services.json b/packages/Upphandling/data/services.json index 1b1b745..198e406 100644 --- a/packages/Upphandling/data/services.json +++ b/packages/Upphandling/data/services.json @@ -1,13 +1,15 @@ { "Underhåll": "arrowhead-right", - "Ny": "sun-outline", - "Utveckling": "cube-outline", - "Översättning": "globe", - "Design": "color-palette", + "Arkitektur": "arrowhead-right", + "Webbutveckling": "sun-outline", + "Apputveckling": "cube-outline", + "Översättningstjänster": "globe", + "Designtjänster": "color-palette", + "Kommunikation och PR": "color-palette", "Produktdesign": "color-palette", - "Produktägare": "color-palette", + "Ledarskapsutveckling": "color-palette", + "Organisationsutveckling": "color-palette", "Agil coach": "color-palette", - "Strateg": "color-palette", - "UX": "person-done", - "Team": "people" + "Strategirådgivning": "color-palette", + "Autonoma team": "people" } diff --git a/packages/Upphandling/data/technologies.json b/packages/Upphandling/data/technologies.json index 1df4982..a7a5399 100644 --- a/packages/Upphandling/data/technologies.json +++ b/packages/Upphandling/data/technologies.json @@ -1,11 +1,11 @@ { "React": "arrowhead-right", - "App": "sun-outline", + "Native apputveckling": "sun-outline", "Frontend": "cube-outline", - "Backend": "globe", - "UX": "color-palette", - "Kubernetes": "person-done", - "Java": "person-done", - "JavaScript": "person-done", - ".NET": "people" + "Backend C#": "globe", + "Backend NodeJs": "globe", + "Backend Java": "globe", + "UX-research": "color-palette", + "UX-design": "color-palette", + "Kubernetes": "person-done" } diff --git a/packages/Upphandling/hooks/useCompanies.js b/packages/Upphandling/hooks/useCompanies.js new file mode 100644 index 0000000..61c4c71 --- /dev/null +++ b/packages/Upphandling/hooks/useCompanies.js @@ -0,0 +1,11 @@ +import { useQuery } from 'react-query' +import { getCompanyFromId } from '../api/companies' +import checkOrgnr from 'se-orgnr-validator' + +export const useCompany = (orgNr) => { + return useQuery('company', () => { + console.log('check orgnr', orgNr) + if (!orgNr || !checkOrgnr (orgNr)) return { data: null, isLoading: false } + return getCompanyFromId(orgNr) + }) +} \ No newline at end of file diff --git a/packages/Upphandling/hooks/useDis.js b/packages/Upphandling/hooks/useDis.js index 4a3b11e..6df3154 100644 --- a/packages/Upphandling/hooks/useDis.js +++ b/packages/Upphandling/hooks/useDis.js @@ -2,6 +2,7 @@ import { useQuery } from 'react-query' import { getDisById } from '../api/dis' export const useDis = (id) => { - return useQuery(['dis', id], () => getDisById(id)) + return useQuery(['dis', id], () => + !id ? { data: null, isLoading: false } : getDisById(id) + ) } - diff --git a/packages/Upphandling/hooks/useOffers.js b/packages/Upphandling/hooks/useOffers.js new file mode 100644 index 0000000..1073cb1 --- /dev/null +++ b/packages/Upphandling/hooks/useOffers.js @@ -0,0 +1,6 @@ +import { useQuery } from 'react-query' +import { getOffers } from '../api/offers' + +export const useOffers = () => ( + useQuery('offers', () => getOffers()) +) \ No newline at end of file diff --git a/packages/Upphandling/hooks/useTenders.js b/packages/Upphandling/hooks/useTenders.js index 1fef496..ccb02e0 100644 --- a/packages/Upphandling/hooks/useTenders.js +++ b/packages/Upphandling/hooks/useTenders.js @@ -1,6 +1,10 @@ import { useQuery } from 'react-query' -import { getTenders } from '../api/tenders' +import { getTenders, getTender } from '../api/tenders' -export const useTenders = () => ( - useQuery('tenders', getTenders) +export const useTenders = (disId) => ( + useQuery(['tenders', disId], () => getTenders(disId)) +) + +export const useTender = (tenderId) => ( + useQuery(['tender', tenderId], () => getTender(tenderId)) ) \ No newline at end of file diff --git a/packages/Upphandling/ios/Upphandling/LaunchScreen.storyboard b/packages/Upphandling/ios/Upphandling/LaunchScreen.storyboard index 15307f9..a93fc2e 100644 --- a/packages/Upphandling/ios/Upphandling/LaunchScreen.storyboard +++ b/packages/Upphandling/ios/Upphandling/LaunchScreen.storyboard @@ -21,7 +21,7 @@ -