Skip to content

Commit

Permalink
minor tweaks/styling
Browse files Browse the repository at this point in the history
  • Loading branch information
Jazcash committed Apr 2, 2023
1 parent 803870d commit 1bf0e03
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 56 deletions.
14 changes: 14 additions & 0 deletions src/renderer/api/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ export class SessionAPI {
public lastBattleResponses: Map<number, Static<typeof lobbySchema>> = new Map();

constructor() {
// TODO: remove class initialisers, do everything in clear function, then call this.clear() from this constructor, and also call .clear() on logout
this.offlineMode.value = false;
this.offlineBattle.value = null;
this.onlineBattle.value = null;
this.users.clear();
this.battles.clear();
this.battleMessages.length = 0;
this.serverStats.value = null;
this.directMessages.clear();

const userData: CurrentUser = {
userId: -1,
username: "Player",
Expand Down Expand Up @@ -67,6 +77,10 @@ export class SessionAPI {
this.friends = computed(() => [...this.onlineUser.friendUserIds].map((id) => this.getUserById(id)!).filter(Boolean));
}

public clear() {
// TODO
}

public updateCurrentUser(myUserData: Static<typeof myUserSchema>) {
this.users.set(myUserData.id, this.onlineUser);

Expand Down
2 changes: 2 additions & 0 deletions src/renderer/components/battle/LuaOptionsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ function save() {
padding: 0 !important;
}
.lua-options-panel {
display: flex;
flex-direction: column;
width: 700px;
height: 600px;
}
Expand Down
2 changes: 0 additions & 2 deletions src/renderer/components/common/TabView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ const emits = defineEmits<Emits>();
background: rgba(255, 255, 255, 0.05);
}
.p-tabview-panels {
min-height: calc(100% - 39px);
max-height: calc(100% - 39px);
overflow-y: auto;
}
.p-tabview-panel {
Expand Down
11 changes: 2 additions & 9 deletions src/renderer/components/navbar/Friends.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</div>

<div class="flex-row gap-md">
<InputNumber
<Number
id="friendId"
v-model="friendId"
type="number"
Expand Down Expand Up @@ -82,14 +82,14 @@
*/
import AccordionTab from "primevue/accordiontab";
import InputNumber from "primevue/inputnumber";
import { InputNumberBlurEvent } from "primevue/inputnumber";
import TabPanel from "primevue/tabpanel";
import { computed, inject, Ref, ref, watch } from "vue";
import Accordion from "@/components/common/Accordion.vue";
import TabView from "@/components/common/TabView.vue";
import Button from "@/components/controls/Button.vue";
import Number from "@/components/controls/Number.vue";
import Friend from "@/components/navbar/Friend.vue";
import PopOutPanel from "@/components/navbar/PopOutPanel.vue";
Expand Down Expand Up @@ -170,12 +170,5 @@ async function addFriend() {
}
:deep(.FriendId) {
flex-grow: 1;
.p-inputnumber {
width: 100px;
}
.p-inputtext {
border: 1px solid rgba(255, 255, 255, 0.1);
background-color: rgba(255, 255, 255, 0.2);
}
}
</style>
88 changes: 46 additions & 42 deletions src/renderer/views/library/replays.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,49 +20,53 @@
</div>
</div>

<DataTable
v-model:first="offset"
v-model:selection="selectedReplay"
:lazy="true"
:value="replays"
:paginator="true"
:rows="limit"
:totalRecords="totalReplays"
selectionMode="single"
dataKey="replayId"
:sortOrder="sortOrder === 'asc' ? 1 : -1"
:sortField="sortField"
@page="onPage"
@sort="onSort"
>
<Column header="Name">
<template #body="{ data }">
<template v-if="isBattle(data)">{{ data.battleOptions.title }}</template>
<template v-else-if="isReplay(data)">
<template v-if="data.preset === 'duel'">
{{ data.contenders?.[0]?.name ?? "Nobody" }} vs
{{ data.contenders?.[1]?.name ?? "Nobody" }}
<div class="flex-col fullheight">
<div class="scroll-container padding-right-sm">
<DataTable
v-model:first="offset"
v-model:selection="selectedReplay"
:lazy="true"
:value="replays"
:paginator="true"
:rows="limit"
:totalRecords="totalReplays"
selectionMode="single"
dataKey="replayId"
:sortOrder="sortOrder === 'asc' ? 1 : -1"
:sortField="sortField"
@page="onPage"
@sort="onSort"
>
<Column header="Name">
<template #body="{ data }">
<template v-if="isBattle(data)">{{ data.battleOptions.title }}</template>
<template v-else-if="isReplay(data)">
<template v-if="data.preset === 'duel'">
{{ data.contenders?.[0]?.name ?? "Nobody" }} vs
{{ data.contenders?.[1]?.name ?? "Nobody" }}
</template>
<template v-else-if="data.preset === 'team'">
{{ data.teams[0].playerCount }} vs {{ data.teams[1].playerCount }}
</template>
<template v-if="data.preset === 'ffa'"> {{ data.contenders.length }} Way FFA </template>
<template v-if="data.preset === 'teamffa'"> {{ data.teams[0].playerCount }} Way Team FFA </template>
</template>
</template>
<template v-else-if="data.preset === 'team'">
{{ data.teams[0].playerCount }} vs {{ data.teams[1].playerCount }}
</Column>
<Column header="Date" :sortable="true" sortField="startTime">
<template #body="{ data }">
{{ format(data.startTime, "yyyy/MM/dd hh:mm a") }}
</template>
<template v-if="data.preset === 'ffa'"> {{ data.contenders.length }} Way FFA </template>
<template v-if="data.preset === 'teamffa'"> {{ data.teams[0].playerCount }} Way Team FFA </template>
</template>
</template>
</Column>
<Column header="Date" :sortable="true" sortField="startTime">
<template #body="{ data }">
{{ format(data.startTime, "yyyy/MM/dd hh:mm a") }}
</template>
</Column>
<Column header="Duration" :sortable="true" sortField="gameDurationMs">
<template #body="{ data }">
{{ getFriendlyDuration(data.gameDurationMs) }}
</template>
</Column>
<Column field="mapScriptName" header="Map" :sortable="true" sortField="mapScriptName" />
</DataTable>
</Column>
<Column header="Duration" :sortable="true" sortField="gameDurationMs">
<template #body="{ data }">
{{ getFriendlyDuration(data.gameDurationMs) }}
</template>
</Column>
<Column field="mapScriptName" header="Map" :sortable="true" sortField="mapScriptName" />
</DataTable>
</div>
</div>
</div>
<div class="right">
<BattlePreview v-if="selectedReplay" :battle="selectedReplay" :showSpoilers="showSpoilers">
Expand Down Expand Up @@ -110,7 +114,7 @@ const endedNormally: Ref<boolean | null> = ref(true);
const showSpoilers = ref(true);
const totalReplays = ref(0);
const offset = ref(0);
const limit = ref(18);
const limit = ref(15);
const sortField: Ref<keyof Replay> = ref("startTime");
const sortOrder: Ref<"asc" | "desc"> = ref("desc");
const replays: Ref<Replay[]> = shallowRef([]);
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/views/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
</TabView>
</Panel>
<div v-else class="flex-col gap-md">
<div class="txt-error">Could not connect to {{ serverAddress }}</div>
<Button class="retry" @click="onRetry">
<div class="txt-error">Disconnected from {{ serverAddress }}</div>
<Button class="retry gap-sm" @click="onRetry">
<Icon :icon="replayIcon" />
Retry
Reconnect
</Button>
</div>
<div class="play-offline" @click="playOffline">Play Offline</div>
Expand Down

0 comments on commit 1bf0e03

Please sign in to comment.