Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
jorbush committed Oct 24, 2024
1 parent cdec4a5 commit a5ab3e4
Show file tree
Hide file tree
Showing 6 changed files with 229 additions and 183 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.postrify.postrifybackend.controller;

import com.postrify.postrifybackend.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -9,14 +10,11 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.postrify.postrifybackend.service.UserService;

@RestController
@RequestMapping("/api/users")
public class UserController {

@Autowired
private UserService userService;
@Autowired private UserService userService;

@GetMapping("/{username}/image")
public ResponseEntity<String> getUserImage(@PathVariable String username) {
Expand All @@ -26,8 +24,7 @@ public ResponseEntity<String> getUserImage(@PathVariable String username) {

@PutMapping("/{username}/image")
public ResponseEntity<String> updateUserImage(
@PathVariable String username,
@RequestBody String base64Image) {
@PathVariable String username, @RequestBody String base64Image) {
userService.updateUserImage(username, base64Image);
return ResponseEntity.ok("User image updated successfully!");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,4 @@ public String getImage() {
public void setImage(final String image) {
this.image = image;
}

}
28 changes: 25 additions & 3 deletions postrify-frontend/src/app/components/header/header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,24 @@ import { SettingsModalComponent } from '../settings-modal/settings-modal.compone
<div class="toggle-container">
@if (authService.isAuthenticated()) {
<button (click)="openSettings()" class="settings-button">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-settings"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z" /><path d="M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0" /></svg>
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="icon icon-tabler icons-tabler-outline icon-tabler-settings"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path
d="M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z"
/>
<path d="M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0" />
</svg>
</button>
}
<button (click)="toggleDarkMode()" class="toggle-button">
Expand Down Expand Up @@ -79,7 +96,11 @@ import { SettingsModalComponent } from '../settings-modal/settings-modal.compone
@if (userImage) {
<img [src]="userImage" alt="User Image" class="user-image" />
} @else {
<img src="assets/placeholder.jpg" alt="User Image" class="user-image" />
<img
src="assets/placeholder.jpg"
alt="User Image"
class="user-image"
/>
}
<span class="username">{{ authService.getUsername() }}</span>
<button class="logout-button" (click)="logout()">
Expand Down Expand Up @@ -168,7 +189,8 @@ import { SettingsModalComponent } from '../settings-modal/settings-modal.compone
color: var(--header-text);
}
.toggle-button, .settings-button {
.toggle-button,
.settings-button {
color: var(--header-text);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ describe('SettingsModalComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [SettingsModalComponent]
})
.compileComponents();
imports: [SettingsModalComponent],
}).compileComponents();

fixture = TestBed.createComponent(SettingsModalComponent);
component = fixture.componentInstance;
Expand Down
Loading

0 comments on commit a5ab3e4

Please sign in to comment.