Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Karakas
SWP_SS24_Wetterdaten_sammeln
Commits
10bdeec9
Commit
10bdeec9
authored
May 12, 2024
by
EnesKarakas
Browse files
Doing some work
parent
d01a045a
Changes
4
Hide whitespace changes
Inline
Side-by-side
frontend/src/components/navbar4.css
View file @
10bdeec9
...
...
@@ -39,25 +39,10 @@
align-items
:
center
;
margin-left
:
var
(
--dl-space-space-twounits
);
}
.navbar4-burger-menu
{
display
:
none
;
}
.navbar4-icon
{
width
:
var
(
--dl-size-size-xsmall
);
height
:
var
(
--dl-size-size-xsmall
);
}
.navbar4-mobile-menu
{
top
:
0px
;
left
:
0px
;
width
:
100%
;
height
:
100vh
;
display
:
none
;
padding
:
var
(
--dl-space-space-twounits
);
z-index
:
100
;
position
:
absolute
;
flex-direction
:
column
;
background-color
:
var
(
--dl-color-theme-neutral-light
);
}
.navbar4-nav
{
display
:
flex
;
align-items
:
flex-start
;
...
...
@@ -101,25 +86,3 @@
left
:
0px
;
position
:
static
;
}
@media
(
max-width
:
767px
)
{
.navbar4-navbar-interactive
{
padding-left
:
var
(
--dl-space-space-twounits
);
padding-right
:
var
(
--dl-space-space-twounits
);
}
.navbar4-desktop-menu
{
display
:
none
;
}
.navbar4-burger-menu
{
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
}
}
@media
(
max-width
:
479px
)
{
.navbar4-navbar-interactive
{
padding
:
var
(
--dl-space-space-unit
);
}
.navbar4-mobile-menu
{
padding
:
var
(
--dl-space-space-unit
);
}
}
frontend/src/style.css
View file @
10bdeec9
...
...
@@ -87,7 +87,6 @@
color
:
var
(
--dl-color-theme-secondary1
);
cursor
:
pointer
;
transition
:
0.3s
;
font-family
:
Noto
Sans
;
font-weight
:
bold
;
padding-top
:
var
(
--dl-space-space-halfunit
);
white-space
:
nowrap
;
...
...
frontend/src/views/data.css
View file @
10bdeec9
.filter
label
{
display
:
block
;
margin-bottom
:
5px
;
}
.filter
input
[
type
=
"text"
],
.filter
select
{
width
:
100%
;
padding
:
8px
;
margin-bottom
:
10px
;
border
:
1px
solid
#ccc
;
border-radius
:
5px
;
}
.filter
button
{
padding
:
10px
20px
;
background-color
:
#007bff
;
color
:
#fff
;
border
:
none
;
border-radius
:
5px
;
cursor
:
pointer
;
transition
:
background-color
0.3s
;
}
.filter
button
:hover
{
background-color
:
#0056b3
;
}
.output
{
margin-top
:
40px
;
}
.checkBoxFilter
{
margin-bottom
:
10px
;
}
#weatherData
{
white-space
:
pre-wrap
;
/* Umbruch von langen Zeilen */
}
#apiUrl
{
margin-top
:
50px
;
}
#apiUrloutput
{
width
:
1250px
;
}
frontend/src/views/data.js
View file @
10bdeec9
...
...
@@ -3,9 +3,90 @@ import React from "react";
import
Navbar4
from
"
../components/navbar4
"
;
import
Footer15
from
"
../components/footer15
"
;
import
"
./home.css
"
;
import
"
./data.css
"
;
const
Data
=
(
props
)
=>
{
//JS Code
function
getData
()
{
const
city
=
document
.
getElementById
(
"
city
"
).
value
;
const
region
=
document
.
getElementById
(
"
region
"
).
value
;
const
country
=
document
.
getElementById
(
"
country
"
).
value
;
const
latitude
=
document
.
getElementById
(
"
latitude
"
).
value
;
const
longitude
=
document
.
getElementById
(
"
longitude
"
).
value
;
const
temperature
=
document
.
getElementById
(
"
temperature
"
).
checked
;
const
isDay
=
document
.
getElementById
(
"
isDay
"
).
checked
;
const
condition
=
document
.
getElementById
(
"
condition
"
).
checked
;
const
pressure
=
document
.
getElementById
(
"
pressure
"
).
checked
;
const
precipitation
=
document
.
getElementById
(
"
precipitation
"
).
checked
;
const
humidity
=
document
.
getElementById
(
"
humidity
"
).
checked
;
const
cloud
=
document
.
getElementById
(
"
cloud
"
).
checked
;
const
feelslikeTemp
=
document
.
getElementById
(
"
feelslikeTemp
"
).
checked
;
const
visibility
=
document
.
getElementById
(
"
visibility
"
).
checked
;
const
uv
=
document
.
getElementById
(
"
uv
"
).
checked
;
const
gust
=
document
.
getElementById
(
"
gust
"
).
checked
;
const
airquality
=
boolToWord
(
document
.
getElementById
(
"
airquality
"
).
checked
);
const
unitTemperature
=
document
.
getElementById
(
"
unitTemperature
"
).
value
;
const
unitWindSpeed
=
document
.
getElementById
(
"
unitWindSpeed
"
).
value
;
const
unitPressure
=
document
.
getElementById
(
"
unitPressure
"
).
value
;
const
unitPrecipitation
=
document
.
getElementById
(
"
unitPrecipitation
"
).
value
;
const
output
=
document
.
getElementById
(
"
output
"
).
value
;
const
format
=
document
.
getElementById
(
"
format
"
).
value
;
const
apiKey
=
"
1244099aeaee4b179e6111803241304
"
;
const
apiUrl
=
`https://api.weatherapi.com/v1/current.
${
format
}
?key=
${
apiKey
}
&q=
${
city
}
&aqi=
${
airquality
}
`
;
fetch
(
apiUrl
)
.
then
((
response
)
=>
{
if
(
!
response
.
ok
)
{
throw
new
Error
(
"
Network response was not ok
"
);
}
return
response
.
json
();
})
.
then
((
data
)
=>
{
// Wetterdaten anzeigen
document
.
getElementById
(
"
weatherData
"
).
innerText
=
JSON
.
stringify
(
data
,
null
,
2
);
document
.
getElementById
(
"
apiUrloutput
"
).
value
=
apiUrl
;
})
.
catch
((
error
)
=>
{
console
.
error
(
"
There was a problem with the fetch operation:
"
,
error
);
});
}
function
searchAPI
()
{
const
cityInput
=
document
.
getElementById
(
"
city
"
).
value
;
const
apiKey
=
"
1244099aeaee4b179e6111803241304
"
;
const
apiUrl
=
`https://api.weatherapi.com/v1/search.json?key=
${
apiKey
}
&q=
${
cityInput
}
`
;
fetch
(
apiUrl
)
.
then
((
response
)
=>
{
if
(
!
response
.
ok
)
{
throw
new
Error
(
"
Network response was not ok
"
);
}
return
response
.
json
();
})
.
then
((
data
)
=>
{
// Wetterdaten anzeigen
document
.
getElementById
(
"
weatherData
"
).
innerText
=
JSON
.
stringify
(
data
,
null
,
2
);
})
.
catch
((
error
)
=>
{
console
.
error
(
"
There was a problem with the fetch operation:
"
,
error
);
});
}
function
boolToWord
(
bool
)
{
return
bool
?
"
yes
"
:
"
no
"
;
}
return
(
<
div
className
=
"
home-container
"
>
...
...
@@ -13,41 +94,131 @@ const Data = (props) => {
<
Navbar4
rootClassName
=
"
navbar4-root-class-name
"
><
/Navbar4
>
<
/div
>
<
div
class
=
"
container
"
>
<
div
class
=
"
box
"
>
<
h1
>
Wetterdaten
abrufen
<
/h1
>
<
div
>
<
div
className
=
"
thq-grid-5
"
>
<
div
class
=
"
filter
"
>
<
label
for
=
"
city
"
>
Stadt
:
<
/label
>
<
input
type
=
"
text
"
id
=
"
city
"
placeholder
=
"
Stadt
"
/>
<
label
for
=
"
city
"
>
City
:
<
/label
>
<
input
type
=
"
text
"
id
=
"
city
"
placeholder
=
"
City
"
/>
<
br
/>
<
label
for
=
"
city
"
>
Region
:
<
/label
>
<
input
type
=
"
text
"
id
=
"
region
"
placeholder
=
"
Region
"
/>
<
br
/>
<
label
>
Country
:
<
/label
>
<
input
type
=
"
text
"
id
=
"
country
"
placeholder
=
"
Country
"
/>
<
br
/>
<
label
>
Latitude
:
<
/label
>
<
input
type
=
"
text
"
id
=
"
latitude
"
placeholder
=
"
Latitude
"
/>
<
label
>
Longitude
:
<
/label
>
<
input
type
=
"
text
"
id
=
"
longitude
"
placeholder
=
"
Longitude
"
/>
<
br
/>
<
/div
>
<
div
>
<
input
type
=
"
checkbox
"
id
=
"
temperature
"
className
=
"
checkBoxFilter
"
/>
<
label
>
Temprature
<
/label
>
<
br
/>
<
input
type
=
"
checkbox
"
id
=
"
isDay
"
className
=
"
checkBoxFilter
"
/>
<
label
>
Is
it
day
?
<
/label
>
<
br
/>
<
input
type
=
"
checkbox
"
id
=
"
condition
"
className
=
"
checkBoxFilter
"
/>
<
label
>
Condition
<
/label
>
<
br
/>
<
input
type
=
"
checkbox
"
id
=
"
pressure
"
className
=
"
checkBoxFilter
"
/>
<
label
>
Pressure
<
/label
>
<
br
/>
<
input
type
=
"
checkbox
"
id
=
"
precipitation
"
className
=
"
checkBoxFilter
"
/>
<
label
>
Precipitation
<
/label
>
<
br
/>
<
input
type
=
"
checkbox
"
id
=
"
humidity
"
className
=
"
checkBoxFilter
"
/>
<
label
>
Humidity
<
/label
>
<
br
/>
<
label
for
=
"
start
"
>
Startdatum
:
<
/label
>
<
input
type
=
"
date
"
id
=
"
start
"
value
=
"
2024-04-24
"
/
>
<
input
type
=
"
checkbox
"
id
=
"
cloud
"
className
=
"
checkBoxFilter
"
/
>
<
label
>
Cloud
<
/label
>
<
br
/>
<
label
for
=
"
end
"
>
Enddatum
:
<
/label
>
<
input
type
=
"
date
"
id
=
"
end
"
value
=
"
2024-05-08
"
/>
<
input
type
=
"
checkbox
"
id
=
"
feelslikeTemp
"
className
=
"
checkBoxFilter
"
/>
<
label
>
Feelslike
Temp
.
<
/label
>
<
br
/>
<
label
for
=
"
storage
"
>
Speicherort
:
<
/label
>
<
select
id
=
"
storage
"
>
<
option
value
=
"
local
"
>
Lokal
<
/option
>
<
option
value
=
"
database
"
>
Datenbank
<
/option
>
<
input
type
=
"
checkbox
"
id
=
"
visibility
"
className
=
"
checkBoxFilter
"
/>
<
label
>
Visibility
<
/label
>
<
br
/>
<
input
type
=
"
checkbox
"
id
=
"
uv
"
className
=
"
checkBoxFilter
"
/>
<
label
>
UV
-
Index
<
/label
>
<
br
/>
<
input
type
=
"
checkbox
"
id
=
"
gust
"
className
=
"
checkBoxFilter
"
/>
<
label
>
Gust
<
/label
>
<
br
/>
<
input
type
=
"
checkbox
"
id
=
"
airquality
"
className
=
"
checkBoxFilter
"
/>
<
label
>
Airquality
<
/label
>
<
br
/>
<
/div
>
<
div
class
=
"
filter
"
>
<
label
>
Temperature
Unit
:
<
/label
>
<
select
id
=
"
unitTemperature
"
>
<
option
value
=
"
temp_c
"
>
Celsius
<
/option
>
<
option
value
=
"
temp_f
"
>
Fahrenheit
<
/option
>
<
/select
>
<
label
>
Wind
speed
Unit
:
<
/label
>
<
select
id
=
"
unitWindSpeed
"
>
<
option
value
=
"
wind_kph
"
>
km
/
h
<
/option
>
<
option
value
=
"
wind_mph
"
>
Mph
<
/option
>
<
/select
>
<
label
>
Pressure
Unit
:
<
/label
>
<
select
id
=
"
unitPressure
"
>
<
option
value
=
"
pressure_mb
"
>
Millibar
<
/option
>
<
option
value
=
"
pressure_in
"
>
Inch
<
/option
>
<
/select
>
<
label
>
Precipitation
Unit
:
<
/label
>
<
select
id
=
"
unitPrecipitation
"
>
<
option
value
=
"
precip_mm
"
>
Millimeter
<
/option
>
<
option
value
=
"
precip_in
"
>
Inch
<
/option
>
<
/select
>
<
/div
>
<
div
class
=
"
filter
"
>
<
label
>
Output
:
<
/label
>
<
select
id
=
"
output
"
>
<
option
value
=
"
local
"
>
Local
<
/option
>
<
option
value
=
"
database
"
>
API
<
/option
>
<
/select
>
<
br
/>
<
label
for
=
"
format
"
>
Dat
en
format
:
<
/label
>
<
label
>
Dat
a
format
:
<
/label
>
<
select
id
=
"
format
"
>
<
option
value
=
"
json
"
>
JSON
<
/option
>
<
option
value
=
"
csv
"
>
CSV
<
/option
>
<
option
value
=
"
xml
"
>
XML
<
/option
>
<
/select
>
<
br
/>
<
button
on
c
lick
=
"
getData()
"
>
Daten
abrufen
<
/button
>
<
button
on
C
lick
=
{
searchAPI
}
>
City
api
<
/button
>
<
/div
>
<
/div
>
<
div
>
<
button
className
=
"
thq-button-filled
"
onClick
=
{
getData
}
>
Generate
<
/button
>
<
/div
>
<
div
class
=
"
box
"
>
<
h2
>
Wetterdaten
<
/h2
>
<
div
class
=
"
output
"
>
<
h2
>
Output
:
<
/h2
>
<
br
/>
<
pre
id
=
"
weatherData
"
><
/pre
>
<
/div
>
<
/div
>
<
div
id
=
"
apiUrl
"
>
<
label
>
API
URL
:
<
/label
>
<
br
/>
<
input
className
=
"
input
"
type
=
"
text
"
id
=
"
apiUrloutput
"
readOnly
/>
<
/div
>
<
div
className
=
"
home-footer11
"
>
<
Footer15
><
/Footer15
>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment