Skip to content

Commit 7d5104e

Browse files
committed
fix: radial bar chart style broken in 1.3k-1.7k px window
1 parent 6f349aa commit 7d5104e

File tree

4 files changed

+31
-24
lines changed

4 files changed

+31
-24
lines changed

api/user/auth.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"github.com/0xJacky/Nginx-UI/api"
55
"github.com/0xJacky/Nginx-UI/model"
66
"net/http"
7+
"time"
78

89
"github.com/gin-gonic/gin"
910
"golang.org/x/crypto/bcrypt"
@@ -29,6 +30,7 @@ func Login(c *gin.Context) {
2930
u, _ := model.GetUser(user.Name)
3031

3132
if err := bcrypt.CompareHashAndPassword([]byte(u.Password), []byte(user.Password)); err != nil {
33+
time.Sleep(5 * time.Second)
3234
c.JSON(http.StatusForbidden, gin.H{
3335
"message": "The username or password is incorrect",
3436
})

app/src/components/Chart/RadialBarChart.vue

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
11
<script setup lang="ts">
22
import VueApexCharts from 'vue3-apexcharts'
3-
import { reactive } from 'vue'
3+
44
import { storeToRefs } from 'pinia'
55
import { useSettingsStore } from '@/pinia'
66
import type { Series } from '@/components/Chart/types'
77
8-
const { series, centerText, colors, name, bottomText }
9-
= defineProps<{
10-
series: Series[] | number[]
11-
centerText?: string
12-
colors?: string
13-
name?: string
14-
bottomText?: string
15-
}>()
8+
const props = defineProps<{
9+
series: Series[] | number[]
10+
centerText?: string
11+
colors?: string
12+
name?: string
13+
bottomText?: string
14+
}>()
1615
1716
const settings = useSettingsStore()
1817
1918
const { theme } = storeToRefs(settings)
2019
21-
const chartOptions = reactive({
22-
series,
20+
const fontColor = () => {
21+
return theme.value === 'dark' ? '#fcfcfc' : undefined
22+
}
23+
24+
const chartOptions = computed(() => ({
25+
series: props.series,
2326
chart: {
2427
type: 'radialBar',
2528
offsetY: 0,
@@ -31,24 +34,24 @@ const chartOptions = reactive({
3134
dataLabels: {
3235
name: {
3336
fontSize: '14px',
34-
color: colors,
37+
color: props.colors,
3538
offsetY: 36,
3639
},
3740
value: {
38-
offsetY: 50,
41+
offsetY: -12,
3942
fontSize: '14px',
40-
color: undefined,
43+
color: fontColor(),
4144
formatter: () => {
42-
return ''
45+
return props.centerText
4346
},
4447
},
4548
},
4649
},
4750
},
4851
fill: {
49-
colors,
52+
colors: props.colors,
5053
},
51-
labels: [name],
54+
labels: [props.name],
5255
states: {
5356
hover: {
5457
filter: {
@@ -61,7 +64,7 @@ const chartOptions = reactive({
6164
},
6265
},
6366
},
64-
})
67+
}))
6568
</script>
6669

6770
<template>
@@ -70,9 +73,6 @@ const chartOptions = reactive({
7073
:key="theme"
7174
class="radial-bar-container"
7275
>
73-
<p class="text">
74-
{{ centerText }}
75-
</p>
7676
<p class="bottom_text">
7777
{{ bottomText }}
7878
</p>
@@ -96,6 +96,9 @@ const chartOptions = reactive({
9696
.radialBar {
9797
position: absolute;
9898
top: -30px;
99+
@media (max-width: 1700px) and (min-width: 1200px) {
100+
top: -10px;
101+
}
99102
@media (max-width: 768px) and (min-width: 290px) {
100103
left: 50%;
101104
transform: translateX(-50%);
@@ -104,14 +107,16 @@ const chartOptions = reactive({
104107
105108
.text {
106109
position: absolute;
107-
top: calc(50% - 5px);
108110
width: 100%;
109111
text-align: center;
110112
}
111113
112114
.bottom_text {
113115
position: absolute;
114116
top: calc(106px);
117+
@media (max-width: 1300px) and (min-width: 1200px) {
118+
top: calc(96px);
119+
}
115120
font-weight: 600;
116121
width: 100%;
117122
text-align: center;

app/src/version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"2.0.0-beta.25","build_id":137,"total_build":341}
1+
{"version":"2.0.0-beta.25","build_id":138,"total_build":342}

app/version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"2.0.0-beta.25","build_id":137,"total_build":341}
1+
{"version":"2.0.0-beta.25","build_id":138,"total_build":342}

0 commit comments

Comments
 (0)