-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
100 lines (87 loc) · 4.54 KB
/
main.go
File metadata and controls
100 lines (87 loc) · 4.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package main
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
"github.com/Whitfrost21/EVault/dashboard"
"github.com/Whitfrost21/EVault/dashboard/mapview"
"github.com/Whitfrost21/EVault/evault"
"github.com/Whitfrost21/EVault/login"
"github.com/Whitfrost21/EVault/managereq"
"github.com/Whitfrost21/EVault/notifymesg"
"github.com/Whitfrost21/EVault/settings"
)
var notifiybut fyne.Widget
func main() {
go evault.StartBackend()
myApp := app.New()
myWindow := myApp.NewWindow("Evault")
dashboardContent := dashboard.CreateDashboard(myWindow)
go mapview.StartMapServer()
go mapview.StartCoordinateServer()
content := container.NewVBox(dashboardContent)
scrollablecontent := container.NewVScroll(content)
updateContent := func(newContent fyne.CanvasObject) {
content.Objects = []fyne.CanvasObject{newContent}
content.Refresh()
}
navbar := widget.NewToolbar(
widget.NewToolbarAction(theme.HomeIcon(), func() {
dashboardContent := dashboard.CreateDashboard(myWindow)
updateContent(dashboardContent)
}),
widget.NewToolbarAction(theme.InfoIcon(), func() {
aboutText := widget.NewLabel("About Evault")
eWasteText := widget.NewLabel("The need for e-waste collection has become increasingly urgent as technology continues to advance at a rapid pace. With the constant release of new electronic devices, old gadgets like phones, computers, and televisions are often discarded improperly, contributing to significant environmental and health hazards. E-waste contains hazardous materials like lead, mercury, and cadmium, which can leak into soil and water, causing long-term damage. Proper e-waste collection helps ensure these devices are recycled safely, recovering valuable materials like gold, silver, and copper while reducing the strain on natural resources. By establishing efficient e-waste collection systems, we can mitigate pollution, promote sustainable practices, and work toward a cleaner, healthier planet.")
eWasteText.Wrapping = fyne.TextWrapWord
eWasteText.Resize(fyne.NewSize(600, 0))
p2 := widget.NewLabel("As the adoption of electric vehicles (EVs) continues to rise, another growing concern is the e-waste generated by these vehicles. While EVs offer a cleaner alternative to traditional gasoline-powered cars, their batteries and electronic components present new recycling and disposal challenges. The batteries used in electric vehicles, particularly lithium-ion batteries, are essential for their operation but are also complex to recycle. Improper disposal of these batteries can lead to the leakage of hazardous chemicals such as lithium, cobalt, and nickel, which can contaminate soil and water. In addition to the batteries, electronic parts, motors, and other components of EVs also contribute to the growing e-waste problem. As EVs reach the end of their life cycle, there is a pressing need for sustainable recycling solutions and better infrastructure to handle the disposal of these critical components. By addressing these challenges, we can reduce the environmental impact of electric vehicles and ensure that their transition to a greener future does not contribute to new forms of pollution.")
p2.Wrapping = fyne.TextWrapWord
p2.Resize(fyne.NewSize(600, 0))
con := container.NewVBox(
aboutText,
widget.NewSeparator(),
eWasteText,
widget.NewSeparator(),
p2,
)
updateContent(con)
}),
)
notifiybut = widget.NewButton("Notifications", func() {
notificationtab := notifymesg.Createnotificationtab(myWindow)
updateContent(notificationtab)
})
sideView := container.NewVBox(
widget.NewButton("Dashboard", func() {
dashboardContent := dashboard.CreateDashboard(myWindow)
updateContent(dashboardContent)
}),
widget.NewButton("Add new", func() {
form := dashboard.Showrequestform(myWindow)
updateContent(form)
}),
widget.NewButton("Settings", func() {
settingContent := settings.CreateThemeswap(myApp)
updateContent(settingContent)
}),
widget.NewButton("Manage Requests", func() {
manageTab := managereq.Createmanagetab(myWindow)
updateContent(manageTab)
}),
notifiybut,
)
sideMenu := container.NewVScroll(sideView)
sideMenu.SetMinSize(fyne.NewSize(200, 400))
mainContent := container.NewHSplit(sideMenu, scrollablecontent)
mainContent.SetOffset(0.2)
page := login.CreateLoginPage(myWindow, navbar, mainContent)
myWindow.SetContent(page)
myWindow.Resize(fyne.NewSize(1200, 600))
myWindow.ShowAndRun()
myWindow.Content().Refresh()
go mapview.ListenForShutdown()
go mapview.Listencoords()
}