Skip to content

Commit 28a04a9

Browse files
committed
refactor: app component and global styles
1 parent 4e53eac commit 28a04a9

File tree

4 files changed

+79
-43
lines changed

4 files changed

+79
-43
lines changed

frontend/src/app/app.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<span *ngFor="let route of routes">
1010
<ion-button [routerLink]="route.url">
1111
<ion-icon slot="start" [name]="route.icon"></ion-icon>
12-
<ion-label [ngClass]="{ active: route.url === routeUrl }">
12+
<ion-label [ngClass]="{ 'active-link': route.url === routeUrl }">
1313
{{ route.label }}
1414
</ion-label>
1515
</ion-button>
@@ -32,7 +32,7 @@
3232
(click)="menu.close()"
3333
>
3434
<ion-icon slot="start" [name]="route.icon"></ion-icon>
35-
<ion-label [ngClass]="{ active: route.url === routeUrl }">
35+
<ion-label [ngClass]="{ 'active-link': route.url === routeUrl }">
3636
{{ route.label }}
3737
</ion-label>
3838
<span *ngIf="displayBadge(route)" class="badge menu-button-badge"></span>

frontend/src/app/app.component.scss

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ ion-header ion-toolbar {
2323
ion-footer ion-toolbar {
2424
padding: 0 8px 0 4px;
2525

26+
@media screen and (min-width: 768px) {
27+
padding: 0;
28+
}
29+
2630
ion-grid {
2731
padding: 0;
2832

@@ -69,10 +73,6 @@ ion-footer ion-toolbar {
6973
}
7074
}
7175

72-
ion-label.active {
73-
text-decoration: underline;
74-
}
75-
7676
ion-menu {
7777
ion-icon,
7878
ion-title {
@@ -94,3 +94,20 @@ ion-menu {
9494
height: 100%;
9595
overflow-y: scroll;
9696
}
97+
98+
.badge {
99+
&.menu-badge {
100+
top: 9px;
101+
right: 4px;
102+
}
103+
104+
&.menu-button-badge {
105+
top: 8px;
106+
left: 58px;
107+
}
108+
109+
&.nav-button-badge {
110+
top: 0;
111+
right: 2px;
112+
}
113+
}

frontend/src/app/app.component.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class AppComponent implements OnInit {
2222
static connectionStatus: "Connecting" | "Connected" | "Disconnected" = "Connecting";
2323
static isCreatingAccount = false;
2424
static platformWidth = 0;
25-
static showProgressBar = false;
25+
static showProgressBar = true;
2626
static unableToConnectToast: HTMLIonToastElement;
2727
static readonly smallScreenWidth = 480;
2828

@@ -159,7 +159,15 @@ export class AppComponent implements OnInit {
159159

160160
displayBadge(route: RouteInfo) {
161161
if (route.url === "/account") {
162-
return !!this.user.devices.find((device) => !device.isVerified);
162+
const { devices, friendRequests, username } = this.user;
163+
return (
164+
devices.find((device) => !device.isVerified) ||
165+
friendRequests.find(
166+
(friendRequest) =>
167+
friendRequest.requestee.username === username &&
168+
friendRequest.status === "Pending"
169+
)
170+
);
163171
}
164172
}
165173

@@ -183,7 +191,6 @@ export class AppComponent implements OnInit {
183191
}
184192

185193
this.title.setTitle("Practical Tuples" + (routeTitle ? ` | ${routeTitle}` : ""));
186-
AppComponent.showProgressBar = false;
187194
}
188195
}
189196
}

frontend/src/global.scss

Lines changed: 46 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ ion-button,
9090
text-transform: none !important;
9191
}
9292

93+
ion-card {
94+
margin: 6px;
95+
}
96+
9397
ion-item {
9498
--padding-start: 0;
9599
}
@@ -99,6 +103,25 @@ ion-list {
99103
}
100104

101105
ion-modal {
106+
&#add-device-modal,
107+
&#friend-request-modal {
108+
min-width: 352px;
109+
--min-width: 352px;
110+
111+
@media screen and (min-width: 768px) {
112+
--height: 190px;
113+
--width: 352px;
114+
}
115+
116+
ion-input {
117+
margin-left: -6px;
118+
}
119+
120+
ion-button {
121+
margin: 0;
122+
}
123+
}
124+
102125
ion-grid {
103126
padding: 0;
104127
}
@@ -111,20 +134,25 @@ ion-modal {
111134
ion-popover {
112135
--max-width: 186px;
113136

114-
&.account-max-devices-popover {
115-
--max-width: 38px;
137+
&.account-select-max-devices {
138+
--max-width: 40px;
139+
}
116140

117-
ion-item {
118-
cursor: pointer;
119-
--min-height: 32px;
141+
&.account-select-max-friends {
142+
--max-width: 50px;
143+
}
120144

121-
ion-label {
122-
margin-left: 14px;
123-
}
145+
&.account-select-max-devices ion-item,
146+
&.account-select-max-friends ion-item {
147+
cursor: pointer;
148+
--min-height: 32px;
124149

125-
ion-radio {
126-
margin-left: -38px;
127-
}
150+
ion-label {
151+
margin-left: 14px;
152+
}
153+
154+
ion-radio {
155+
margin-left: -38px;
128156
}
129157
}
130158

@@ -156,7 +184,7 @@ ion-toast {
156184
--max-width: 320px;
157185

158186
&::part(button) {
159-
margin: 6px -2px 0 0;
187+
margin: 5px -2px 0 0;
160188
}
161189

162190
&::part(container) {
@@ -171,32 +199,16 @@ ion-toolbar,
171199
max-width: 768px;
172200
}
173201

202+
.active-link {
203+
text-decoration: underline;
204+
}
205+
174206
.badge {
175-
z-index: -1;
207+
cursor: pointer;
176208
position: absolute;
177209
padding: 6px;
178210
border-radius: 6px;
179211
background-color: var(--ion-color-primary);
180-
181-
&.device-verify-badge {
182-
top: -6px;
183-
right: 7px;
184-
}
185-
186-
&.menu-badge {
187-
top: 9px;
188-
right: 4px;
189-
}
190-
191-
&.menu-button-badge {
192-
top: 8px;
193-
left: 58px;
194-
}
195-
196-
&.nav-button-badge {
197-
top: 0;
198-
right: 2px;
199-
}
200212
}
201213

202214
.d-flex {
@@ -225,7 +237,7 @@ ion-toolbar,
225237
}
226238

227239
.page-grid {
228-
margin: 0;
240+
margin: 0 -2px;
229241
padding: 0;
230242

231243
.title-row {

0 commit comments

Comments
 (0)