Skip to content

Commit

Permalink
Interfaceshows if a cassette is denied or approved
Browse files Browse the repository at this point in the history
  • Loading branch information
Coll6 committed Dec 15, 2024
1 parent d16ea13 commit 699a314
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
9 changes: 7 additions & 2 deletions monkestation/code/modules/cassettes/cassette_approval.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ GLOBAL_LIST_INIT(cassette_reviews, list())
var/obj/item/device/cassette_tape/submitted_tape

var/action_taken = FALSE
var/verdict = "NONE"

/datum/cassette_review/Destroy(force)
. = ..()
Expand Down Expand Up @@ -122,6 +123,7 @@ GLOBAL_LIST_INIT(cassette_reviews, list())
to_chat(submitter, span_warning("You feel a wave of disapointment wash over you, you can tell that your cassette was denied by the Space Board of Music"))
logger.Log(LOG_CATEGORY_MUSIC, "[submitter]'s tape has been rejected by [usr]", list("approver" = usr.name, "submitter" = submitter.name))
action_taken = TRUE
verdict = "DENIED"

/datum/cassette_review/proc/approve_review(mob/user)
if(!check_rights_for(user.client, R_FUN))
Expand All @@ -132,6 +134,7 @@ GLOBAL_LIST_INIT(cassette_reviews, list())
message_admins("[submitter]'s tape has been approved by [user]")
logger.Log(LOG_CATEGORY_MUSIC, "[submitter]'s tape has been approved by [user]", list("approver" = user.name, "submitter" = submitter.name))
action_taken = TRUE
verdict = "APPROVED"

/proc/fetch_review(id)
return GLOB.cassette_reviews[id]
Expand Down Expand Up @@ -185,12 +188,14 @@ GLOBAL_LIST_INIT(cassette_reviews, list())
var/submitters_name = cassette.submitter
var/obj/item/tape_obj = cassette.submitted_tape
var/reviewed = cassette.action_taken
var/verdict = cassette.verdict

// Add this cassette's data under its cassette_id
// Add this cassette's data under its cassette_id
data["cassettes"][cassette_id] = list(
"submitter_name" = submitters_name,
"tape_name" = tape_obj.name,
"reviewed" = reviewed
"reviewed" = reviewed,
"verdict" = verdict,
)
return data

Expand Down
21 changes: 17 additions & 4 deletions tgui/packages/tgui/interfaces/CassetteManager.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ export const CassetteManager = (props) => {
const { cassettes } = data;

return (
<Window width={600} height={313}>
<Window title="Cassette Manager" width={600} height={313}>
<Window.Content>
<Section title="Cassette Manager">
<Section title="List of This Shift's Submissions">
{cassettes && Object.keys(cassettes).length > 0 ? (
<Table>
<Table.Row header>
<Table.Cell>Cassette ID</Table.Cell>
<Table.Cell>Cassette ID_CKey</Table.Cell>
<Table.Cell>Submitter</Table.Cell>
<Table.Cell>Title</Table.Cell>
<Table.Cell>Reviewed</Table.Cell>
Expand All @@ -33,7 +33,20 @@ export const CassetteManager = (props) => {
{cassetteData.reviewed ? 'Yes' : 'No'}
</Table.Cell>
<Table.Cell>
<Button onClick={() => act(cassetteId)}>Review</Button>
{cassetteData.reviewed ? (
// If reviewed is true, check the verdict
cassetteData.verdict === 'APPROVED' ? (
<Button color="green">Approved</Button>
) : cassetteData.verdict === 'DENIED' ? (
<Button color="red">Denied</Button>
) : (
<Button onClick={() => act(cassetteId)}>
Review
</Button>
)
) : (
<Button onClick={() => act(cassetteId)}>Review</Button>
)}
</Table.Cell>
</Table.Row>
),
Expand Down

0 comments on commit 699a314

Please sign in to comment.