Commit Graph

32 Commits

Author SHA1 Message Date
Rob Bailey
b8fc54a914 Dropdowns v2 (#75164)
## About The Pull Request

Complete rewrite of dropdowns to use popper elements that are injected
at the body level.
This means they are now horribly overcomplicated and also suck a lot
less

![2023-05-04_06-57-12](https://user-images.githubusercontent.com/5194834/236229806-2f676e7b-d6c5-427a-af2f-520d883be790.gif)
Also ported `Icon` to typescript for a reason that didn't end up making
it in the PR

## Why It's Good For The Game

![image](https://user-images.githubusercontent.com/5194834/236226086-35ec2009-e9a9-404b-9b52-3ab8de0a0ae6.png)

![image](https://user-images.githubusercontent.com/5194834/236226573-880c0380-0f70-41c7-90c6-d51ba4238561.png)

## Changelog
🆑
add: good tgui dropdowns
del: tgui dropdown suck
qol: tgui dropdowns suck less
balance: buffed tgui dropdowns
/🆑
2023-05-07 12:40:18 -07:00
ZeWaka
836d1c65d4 TGUI Button iconPosition prop documentation (#71489)
## About The Pull Request

documents the `iconPosition` tgui button prop from 55109

## Why It's Good For The Game

people can know it exists

## Changelog

no
2022-11-24 22:08:04 +02:00
vincentiusvin
b7f7b5700e LabeledList Kitchen Sink (#69532)
Looks like I've documented most of the labeledlist props in my previous PR so there is pretty much nothing else to do here except className.

Why It's Good For The Game

More examples for newer coders.
2022-08-29 22:42:58 -07:00
vincentiusvin
6f8e2a9d71 Lets LabeledList.Item's label wrap if they want. Docs the rest of the props. (#69459)
* Adds wrap toggle

* Documentation

* Less ambiguity
2022-08-28 17:18:42 +03:00
Aleksej Komarov
b86cf89125 tgui: API improvements + docs (#65943)
About The Pull Request

This pull request improves tgui API in many ways.

Using TGUI for custom HTML popups

This standardizes and simplifies the process of HTML popup creation and DM <-> JS communication.

Makes tgui window API a perfect alternative for old-style browser panels. It will be super useful for @Iamgoofball since he wanted to make a lightweight browser element that plays background music, and this will make his life a lot easier.

It is now possible to create tgui windows with fully inlined JS and CSS, which can be used to make unkillable tgui-based UIs (can't white/blue screen due to network errors). You can split files into JS and CSS, and still serve a single HTML file using this.

Moved sendMessage function to the Byond API object, where it rightfully belongs, and now supports a shorthand form: Byond.sendMessage(type, payload). This shortens and simplifies a lot of code.

Refactored window.update to no longer be public. Now to subscribe to incoming messages, you should use new public APIs: Byond.subscribe(fn) and Byond.subscribeTo(type, fn), and TGUI internally uses these functions as well, which reduces boilerplate in index.js.

Renamed window.__windowId__ to Byond.windowId (old variable is still available for backwards compatibility).

Byond API now supports null id, e.g. Byond.winget(null, 'url'), which makes things like this possible:

// Fetch URL of a currently connected server
Byond.winget(null, 'url').then((serverUrl) => {
  // Connect to this server (opens a new dreamseeker instance)
  Byond.call(serverUrl);
  // Close this client because new instance is connecting
  Byond.command('.quit');
});

Certain polyfills are now statically compiled (commited into git) and are baked into tgui.html. The downside is that HTML went 16 kB -> 50 kB. The upside is that you can now use a relatively modern level API with full support for IE8 when writing plain old html UIs using /datum/tgui_window directly. They are committed into git, because polyfills will never need to be updated (unless of course we randomly decide to get rid of ie8.js and html5shiv.js).
Breaking Changes

No breaking changes. This should be tested for regressions. Upgrading is simple if you're on a relatively up-to-date branch - copy paste all affected tgui files and you're good.
2022-04-18 14:07:55 +12:00
vincentiusvin
47ee4b0ab0 Brings back button vertical alignment prop (#65054)
poggers??

Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
2022-03-02 18:15:31 +02:00
vincentiusvin
2ea640896d Revert "Vertical alignment for tgui button content (#62525)" (#62584)
This reverts commit 8e526a575a.
2021-11-05 01:05:01 +02:00
vincentiusvin
8e526a575a Vertical alignment for tgui button content (#62525)
Adds a verticalAlign prop for buttons that will wrap the content and icons in it in a flexbox and center/flex-end them. Made this an optional prop so it doesn't break browsers with bricked flexboxes.

Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
2021-11-04 09:08:04 +02:00
esainane
7f6dab25b8 HFR frontend rework (#61737)
This makes the interface much more usable, and tries to help introduce the concepts involved in a very complicated system. The current interface is a bit clunky to use, and does not offer much guidance as to what actions are possible, or what the implications of taking them might be. You can't see the readouts at the same time you're tweaking the controls. Many failure states are not warned about, or even made clear when they're actively happening. To this end, this PR provides many very helpful qol changes, listed in the changelog below.
2021-10-25 11:20:14 -04:00
esainane
464bae0c22 tgui: Add new and disambiguate old gas colors (#61381)
This PR adds color mappings for new gases, and disambiguates color mappings for old gases where multiple gases used one color - many used red, or purple.

Most of these have been around for a while, but were missing color mappings in interfaces.

This mainly affects the HFR gas list interface.
2021-09-19 20:54:22 +01:00
AnturK
d406419439 Adds preserveWhitespace tgui Box property (#59383)
* Adds preserveWhitespace tgui Box property

* Update Box.tsx

* Update Box.tsx

* Update ExodroneConsole.tsx

Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
2021-05-31 01:01:14 -04:00
Celotajs
190d0a0384 Replace alert usage with tgui_alert (#58419)
Pretty much every alert() call is replaced with tgui_alert, except one I replaced with tgalert as a fallback. If tgui_alert exists, why not use it?
2021-05-20 22:43:27 +12:00
Mothblocks
10bee5db78 Popper Tooltips 2 (they don't crash this time) (#58980)
Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
2021-05-17 23:43:40 +03:00
Aleksej Komarov
9bb07456cc Revert "Switch tgui tooltips to popper.js" (#58078)
* Revert "Switch tgui tooltips to popper.js (#57992)"

This reverts commit 206c8215de.

* Revert "Fix Tooltip documentation (#58013)"

This reverts commit e692b05a99.
2021-03-31 05:04:43 -07:00
Mothblocks
e692b05a99 Fix Tooltip documentation (#58013) 2021-03-28 14:54:05 +03:00
Mothblocks
206c8215de Switch tgui tooltips to popper.js (#57992)
* Preliminary popper support

* Switch tooltips to popper.js

* Documentation, change DEFAULT_PLACEMENT
2021-03-27 23:40:58 +02:00
Aleksej Komarov
9d4a3f1556 Nuke Window resizable and improve drag code (#56727) 2021-02-09 15:40:53 +01:00
Aleksej Komarov
ba5d1f1c7e Fix ExoFab UI and Section bugs, improve Tabs, upgrade deps (#56721)
Fixes #56237
    Unblocks #56704

Besides fixing the above mentioned issue with ExoFab UI, I fixed a few tgui component bugs and added a few improvements. Not really atomizable, sorry.
Section changes

    level property is now gone, section level is automatically calculated.
    Nested sections automatically become transparent.
    Nested sections are now properly incapsulated and won't inherit properties of parent sections.
        This allows using nested non-scrollable sections, while parent is, for example, scrollable.

Tabs changes

    Tabs without a parent section will pretend they are a section (and will look as such, with dark background).
    Top corners of tabs are a bit rounded to make it look more like a tab.
    Background color for selected and hovered tabs (previously it was just an underline).
    2px margin around the tabs, to make them stand out a bit from the section background.

Two new props:

    fill - Same as <Section fill>
    fluid - Tabs use full width of the container.

scrollable property was not implemented because it's a bit complicated (requires converting it into a class, registering its scrollable node with tgui, etc). If you need scrollable, just wrap tabs with a Section like a good man.
2021-02-08 18:19:25 -03:00
Aleksej Komarov
a6e60e47e7 tgui 4.3 (#56080) 2021-01-16 19:54:31 -08:00
Rob Bailey
cb01640043 Filterrific! (#55246)
Filter refactor + In Game Filter Editor
Accessed via VV in the dropdown of atoms. "Edit Filters.
Makes filters actually usable.

Co-authored-by: ghgh <hghgh>
2020-12-18 20:05:20 +02:00
Bobbahbrown
24e447418a tgui: Round Gauge (#55230)
This PR introduces the wacky round gauge for showing all of your favourite metrics in half-circle format. Show off those wacky numbers, use some scary blinking lights, feel alive!

I've also gone ahead and included this in the canister and tank (think internals) UIs. I've also done some refactoring of data sending from canisters because GOSH DANG it required some.
2020-11-30 18:48:52 +02:00
Bobbahbrown
4e48e1379d Interview System / Soft Panic Bunker (#54465)
About The Pull Request

Ports and improves my interview system that has been previously used in the summer ball and toolbox tournament events. Allows for a 'softer' panic bunker, wherein players who fall below the required living time limit can still join the server and be restricted to filling out a questionnaire. Upon completing the questionnaire, the player may be allowed into the server by an administrator. If the application is approved, they get a notification that they will be reconnected and upon reconnecting will have all verbs as they usually would. If the application is denied the user is put on a cooldown after which they may submit a new questionnaire.

Players who are being interviewed (herein interviewees) have no verbs other than those required for the stat panel to function, as well as a verb to pull up the interview panel. Interviews do not persist through restarts, and the ability to join that is granted by an accepted interview is only valid for the duration of that round.

Open interviews are listed under a new 'interviews' tab for admins, which is VERY similar to the existing tickets tab.

Below is what a player who is flagged as an interviewee will see when they join the server. They can do nothing but respond to the questionnaire or leave.
image

This is what an administrator sees after an interview is submitted, they will also see a corresponding message within their chatbox, and an age-old BWOINK when an interview is submitted.
image

The interviews tab, which is similar to the tickets menu. You can open the interview manager panel to view all active (including non-submitted) interviews, queued (submitted) interviews, and closed interviews.

image
FAQ:

What happens if someone submits an interview when no admins are on? It's treated like adminhelps are, the message gets sent to TGS to be dispatched off to configured end-points (like Discord or IRC), and the user is notified that their interview was handled this way.

Can you configure the questions? Yes, in config/ there is now a interviews.txt file in which the welcome message and the individual questions can be set and modified.

Can this be turned on and off during a round? Yes, it can be toggled like the panic bunker. It requires the panic bunker to be raised in order to function.

Can interviewees have further questions asked to them? Yes, if you admin-pm them, which is possible using regular means or a conveniently placed button on the interview UI, they will be able to respond to the message.
Technical details

To use the interview system you must have the panic bunker enabled, this is an additional setting for the panic bunker. It can be set through the PANIC_BUNKER_INTERVIEW setting in config.txt, or alternatively enabled in-game as prompted during the panic bunker toggling process. It also can be toggled on its own using a verb added for this purpose, Toggle PB Interviews found under the server tab. These new actions are included in the logging for the panic bunker. I have also added a reporting stat to the world topic status keyword, which now reports if the interview system is on using the keyword interviews.

As mentioned above, for server operators, configure the questions and welcome message in config/interviews.txt.

Note to maintainers and those with big brains I had to add a call to init_verbs on the stat panel window being ready because seemingly a race condition exists wherein the add_verb of the 'view my interview' verb doesn't cause a refresh of the tabs (and therefore doesn't show the 'Interview' tab) when running in dream daemon but running it directly from visual studio code properly shows the tab. Adding a init_verbs call directly after adding the verb didn't seem to help.
A note for downstreams

If you don't use the HTML stat panel (which may not be a bad thing) then you will have to do some conversion from the HTML stat panel stuff used here to the old style stat panels. It's pretty trivial, but just be aware of that. You can see how I used to use the old stat panels in my PR from the summer ball, here, which should be helpful.
Why It's Good For The Game

This allows for a softer version of the panic bunker which impedes the flow of malicious players while allowing genuine players a chance to enter a round to gain enough time to not be affected by the panic bunker's restrictions.
Changelog

🆑 bobbahbrown
add: Added the interview system, a 'soft' panic bunker which lets players who would normally be blocked from joining be interviewed by admins to be selectively allowed to play.
/🆑
2020-10-25 14:10:06 +13:00
ThePotato
fbe2cede66 tgui: Icon Stacking (#54212)
* adds icon stacking to tgui

* Docmentation for Icon.Stack, added classnames to icon, Added a component that can stack child icons.

Co-authored-by: Style Mistake <stylemistake@gmail.com>

* Cosmetic 1

* Cosmetic 2

Co-authored-by: Style Mistake <stylemistake@gmail.com>
2020-10-07 08:37:47 +03:00
ThePotato97
115354be8e It's not confirmMessage, it's confirmContent (#53752) 2020-09-16 01:42:17 +03:00
tralezab
6a25b30b12 Removes "availible" mispellings in codebase (#53046)
* AVAILABLE

* Rebuild tgui

Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
2020-08-19 23:57:37 +03:00
Aleksej Komarov
0e1b20e6db tgchat (#52426)
Replaces goonchat with a tgui based chat panel

    Fixes #52898
    Fixes #52663

It is as fast as goonchat was (if not faster in certain circumstances), and is very extensible. It has all the necessary code for sorting messages into categories, which means that one of the next features will be multiple tab support.

Additional features that you will get with tgchat right now:
    Massively faster server-side performance compared to goonchat, especially if batching multiple messages to one client.
    Message persistence across rounds and reconnects. (All messages are stored client-side in IndexedDB)
    More robust scroll tracking. If you scroll up, it will not change the scroll position on new messages like goonchat did.
    Multiple message combining. (Currently set to combine up to 5 messages over last 5 seconds).
    If using the highlighting feature, it highlights the whole message as well as the matching word.
    "Now playing" widget, with preview of the song title, a knob for adjusting the volume and a stop button.

Architecture is as following:
```
to_chat() -+
           |
        SSchat
   (queue, batching)
           |
  window.send_message()
           |
           v
+-------------+
| tgui-panel  |
|+-----------+|
|| tgchat    ||
|+-----------+|
+-------------+
```

Subsystem is basically goonchat, but without all the garbage that slows the servers down (string concatenation, double urlencoding, sanitizing, etc). Now, instead of all that, it's being slowed down by json_encode in /datum/tgui_window/proc/send_message, which IMO is completely worth it, and allows sending various templates and widgets to tgchat.

/datum/tgui_window abstracts the whole window away from you, establishes a nice message-passing interface between DM and JS, with two message queues on each side, automatically loads js/css assets for you, basically does everything. You as a developer only have to worry about sending/receiving messages and write javascript.

tgui-panel is a slimmed down version of tgui, and functions as a container for various widgets, and tgchat is one of them. It of course can be expanded with more stuff.

It's also a separate entry point and a JS bundle, so it's not bloating the main tgui bundle, and is currently sitting at about 230kB.
2020-08-14 13:21:40 +12:00
Aleksej Komarov
0cf00a2645 tgui 4.0 (#52085)
* tgui 4.0 hyper squash

* Upgrade dependencies
2020-07-16 20:13:04 +02:00
spessman-007
5ae305ec9f Resolve issues with incorrect usage of a/an (#51095)
Co-authored-by: NewSta <spessman-007@users.noreply.github.com>
2020-05-25 01:34:34 +08:00
Aleksej Komarov
5ba866b190 tgui: Better Canister (#50692)
* tgui: Better Canister

* Rebuild tgui
2020-04-27 08:35:06 +03:00
Aleksej Komarov
d86c667901 tgui: Fix Crafting, Tweak Box Units (#50577)
* Fix PersonalCrafting

* Half em units for margin/padding, full em unit for everything else.

* Update docs

* Opsie

* Rebuild tgui

* Let's pretend that IE10 is IE8

Closes #50588

* Assert dominance
2020-04-20 23:24:19 -07:00
Aleksej Komarov
2979838c38 Fixes, Reworks, New Tabs and General Misery 2020-04-19 19:38:55 +03:00
Aleksej Komarov
184a0f53ce Update the docs
Update the docs

Fix some bugs in README
2020-04-19 19:38:53 +03:00