Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor HTML: Remove unnecessary header tags, improve design, and fix layout bugs #604

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

adhershmnair
Copy link
Contributor

@adhershmnair adhershmnair commented Nov 26, 2024

Description

403 Forbidden fontawesome script.
image

Amount overflow issue.
image

Checklist

  • I have personally loaded this code into an updated qbcore project and checked all of its functionality.
  • My code fits the style guidelines.
  • My PR fits the contribution guidelines.

Comment on lines +435 to +439
if (this.dragStartInventoryType === "player" && targetInventoryType === "other" && isShop !== -1) {
this.inventoryError(this.currentlyDraggingSlot, "player");
throw new Error("You cannot sell items to this shop.");
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If player drag items from player inventory to shop inventory, currently it was swapping the items in inventory, which was confusing.

Added warning when we do this.

Comment on lines +511 to +519

if (this.transferAmount === null) {
if (this.firstBulkPurchase === true) {
this.firstBulkPurchase = false;
this.inventoryError(sourceSlot, "other", true);
console.error("Purchasing items in bulk. Next time there will be no warning...");
return;
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a warning for first-time users when they attempt to make a bulk purchase without specifying the amount. Some players forget to enter the amount, resulting in an unintended bulk purchase.

Comment on lines +520 to +528

const sourceInventory = this.getInventoryByType("other");
const targetInventory = this.getInventoryByType("player");
const amountToTransfer = transferAmount !== null ? transferAmount : sourceItem.amount;
if (sourceItem.amount < amountToTransfer) {
this.inventoryError(sourceSlot, "other");
return;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the amount checking condition before attempting purchase from lua.

let targetItem = targetInventory[targetSlot];
if (!targetItem || targetItem.name !== sourceItem.name) {
let foundSlot = Object.keys(targetInventory).find((slot) => targetInventory[slot] && targetInventory[slot].name === sourceItem.name);
if (foundSlot) {
if (foundSlot && sourceItem.unique == false) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the item is unique, place the item in a new slot.

if (slotElement) {
slotElement.style.backgroundColor = "red";
slotElement.style.backgroundColor = warning ? "yellow" : "red";
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed inventoryError function to show color in correct Inventory and fixed the slot id issue.

@@ -6,7 +6,7 @@
<title>QB Inventory</title>
<link rel="stylesheet" href="main.css" />
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/style.css" />
<script src="https://kit.fontawesome.com/d37231be1f.js" crossorigin="anonymous"></script>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the 403 Forbidden script.

Comment on lines -405 to +414
width: 4%;
width: 6%;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Increased width for amount field for better visibility.

Comment on lines +428 to +433
.input-container input::-webkit-outer-spin-button,
.input-container input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hide the input number spinner from input field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant