Skip to content

Commit 0c31d88

Browse files
authored
0.1.7 (#75)
- More obvious prompt to install Winch
2 parents 365d50f + 8997478 commit 0c31d88

10 files changed

Lines changed: 61 additions & 18 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "dredge_mod_manager",
33
"private": true,
4-
"version": "0.1.6",
4+
"version": "0.1.7",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

src-tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "dredge_mod_manager"
3-
version = "0.1.6"
3+
version = "0.1.7"
44
description = "Mod manager application for DREDGE"
55
authors = ["xen-42"]
66
license = "MIT"

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"package": {
1010
"productName": "Dredge Mod Manager",
11-
"version": "0.1.6"
11+
"version": "0.1.7"
1212
},
1313
"tauri": {
1414
"allowlist": {

src/components/mods/ModList.tsx

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ export const ModList = (props: {selected: string, searchQuery: string, setSearch
143143

144144
let availableList = new Array<React.ReactNode>()
145145
let installedList = new Array<React.ReactNode>()
146+
let modLoaderList = new Array<React.ReactNode>()
146147

147148
const app = context!.state
148149

@@ -192,17 +193,34 @@ export const ModList = (props: {selected: string, searchQuery: string, setSearch
192193
} return
193194
}).filter(x => x) // remove null
194195
}
196+
197+
if (modList.findIndex(mod => mod.ModGUID == "hacktix.winch") == -1) {
198+
const filteredMods = filterSortMods(database!, props.searchQuery, props.sortField, props.sortDirection);
199+
modLoaderList = filteredMods.map((mod) => {
200+
if (!info!.has(mod.ModGUID) && mod.ModGUID == "hacktix.winch") {
201+
return <AvailableMod
202+
key={mod.ModGUID}
203+
data={mod}
204+
installMod={installMod}/>
205+
} return
206+
}).filter(x => x) // remove null
207+
}
195208
}
196209

197210
let shownList = availableList
198211

199-
if (props.selected === "Installed") {
200-
// #6 Prompt user to install Winch if it is not installed
201-
if (modList.findIndex(mod => mod.ModGUID == "hacktix.winch") == -1) {
202-
return <div className="mods-not-found">
203-
All mods require the Winch modloader to be installed. Download it in the "Available" tab.
212+
// #6 Prompt user to install Winch if it is not installed
213+
if (modList.findIndex(mod => mod.ModGUID == "hacktix.winch") == -1) {
214+
return <div className="center">
215+
<div className="mods-not-found">
216+
<h3 className="warning">All mods require the Winch modloader to be installed!</h3>
217+
<h2 className="warning">Install it now!</h2>
218+
{modLoaderList}
204219
</div>
205-
}
220+
</div>
221+
}
222+
223+
if (props.selected === "Installed") {
206224
shownList = installedList;
207225
}
208226

src/components/mods/Mods.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import React, { useState } from 'react'
1+
import React, { useContext, useState } from 'react'
22

33
import '../../scss/mods/mods.scss'
44

5+
import {AppContext} from "../appcontext";
56
import { ModsTab } from "./ModsTab"
67
import { ModList } from "./ModList"
78

@@ -14,10 +15,16 @@ export const Mods = (props: {selected: string, searchQuery: string, setSearchQue
1415
}) => {
1516
const [selectedTab, setSelectedTab] = useState(props.selected)
1617

18+
const context = useContext(AppContext)
19+
const app = context!.state
20+
const info = app.modInfos
21+
let modList = Array.from(info!.values())
22+
const winchInstalled = modList.findIndex(mod => mod.ModGUID == "hacktix.winch") !== -1;
23+
1724
return <div className="mods-container">
1825
<div className="mods-selectors">
1926
<ModsTab selected={selectedTab} setSelected={setSelectedTab}>Installed</ModsTab>
20-
<ModsTab selected={selectedTab} setSelected={setSelectedTab}>Available</ModsTab>
27+
<ModsTab selected={selectedTab} setSelected={setSelectedTab} hide={!winchInstalled}>Available</ModsTab>
2128
<div className="mods-filler"/>
2229
</div>
2330
<div className="mods-list-container">

src/components/mods/ModsTab.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ import React from "react";
55
interface IModsTabProps {
66
selected: string,
77
children: string,
8+
hide?: boolean,
89
setSelected: (selected: string) => void
910
}
1011

1112
export const ModsTab = (props: IModsTabProps) => {
12-
return <button id={`mods${props.children}`}
13+
return props.hide ? <div></div> : <button id={`mods${props.children}`}
1314
className={props.selected === props.children ? "selected" : ""}
1415
onClick={() => {props.setSelected(props.children)}}>
1516
<label>{props.children}</label>

src/scss/mods/modsNotFound.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
text-align:center;
1414

1515
margin: auto auto;
16-
max-width: 400px;
16+
max-width: 600px;
1717

1818
& .info,
1919
& .reload {

src/scss/settings.scss

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,31 @@
8686

8787
.warning {
8888
font-weight: 600;
89-
font-size: 1.2em;
9089
color: yellow;
9190
}
9291

9392
.error {
9493
font-weight: 600;
95-
font-size: 1.2em;
9694
color: red;
9795
}
9896
}
97+
}
98+
99+
.warning {
100+
font-weight: 600;
101+
color: yellow;
102+
}
103+
104+
.error {
105+
font-weight: 600;
106+
color: red;
107+
}
108+
109+
.center {
110+
margin: auto;
111+
text-align: center;
112+
align-items: center;
113+
display: flex;
114+
justify-content: center;
115+
height: 100%;
99116
}

0 commit comments

Comments
 (0)