mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 17:52:36 +00:00
Refactor folder & consistency (#57400)
* refactor folder tsx * Right-click to remove paper
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
/obj/item/folder/examine()
|
||||
. = ..()
|
||||
if(contents)
|
||||
. += "<span class='notice'>Alt-click to remove [contents[1]].</span>"
|
||||
. += "<span class='notice'>Right-click to remove [contents[1]].</span>"
|
||||
|
||||
/obj/item/folder/proc/rename(mob/user)
|
||||
if(!user.is_literate())
|
||||
@@ -49,10 +49,11 @@
|
||||
to_chat(user, "<span class='notice'>You remove [Item] from [src].</span>")
|
||||
update_icon()
|
||||
|
||||
/obj/item/folder/AltClick(mob/user)
|
||||
..()
|
||||
if(contents)
|
||||
/obj/item/folder/attack_hand(mob/user, list/modifiers)
|
||||
if(LAZYACCESS(modifiers, RIGHT_CLICK))
|
||||
remove_item(contents[1], user)
|
||||
return TRUE
|
||||
. = ..()
|
||||
|
||||
/obj/item/folder/update_overlays()
|
||||
. = ..()
|
||||
|
||||
@@ -6,40 +6,39 @@ export const Folder = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
const { theme, bg_color, folder_name, contents, contents_ref } = data;
|
||||
return (
|
||||
<Window title={folder_name || "Folder"} theme={theme} width={400} height={500}>
|
||||
<Window
|
||||
title={folder_name || "Folder"}
|
||||
theme={theme}
|
||||
width={400}
|
||||
height={500}
|
||||
>
|
||||
<Window.Content backgroundColor={bg_color || "#7f7f7f"} scrollable>
|
||||
{contents.length > 0 ? (
|
||||
<>
|
||||
{contents.map((item, index) => (
|
||||
<>
|
||||
<Flex
|
||||
color="black"
|
||||
backgroundColor="white"
|
||||
style={{ padding: "2px 2px 0 2px" }}
|
||||
>
|
||||
<Flex.Item align="center" grow={1}>
|
||||
<Box align="center">{item}</Box>
|
||||
</Flex.Item>
|
||||
<Flex.Item>
|
||||
{
|
||||
<Button
|
||||
icon="search"
|
||||
onClick={() =>
|
||||
act("examine", { ref: contents_ref[index] })}
|
||||
/>
|
||||
}
|
||||
<Button
|
||||
icon="eject"
|
||||
onClick={() =>
|
||||
act("remove", { ref: contents_ref[index] })}
|
||||
/>
|
||||
</Flex.Item>
|
||||
</Flex>
|
||||
<Box style={{ height: "0.25em" }} />
|
||||
</>
|
||||
))}
|
||||
</>
|
||||
) : (
|
||||
{contents.map((item, index) => (
|
||||
<Flex
|
||||
key={contents_ref[index]}
|
||||
color="black"
|
||||
backgroundColor="white"
|
||||
style={{ padding: "2px 2px 0 2px" }}
|
||||
mb={0.5}
|
||||
>
|
||||
<Flex.Item align="center" grow={1}>
|
||||
<Box align="center">{item}</Box>
|
||||
</Flex.Item>
|
||||
<Flex.Item>
|
||||
{
|
||||
<Button
|
||||
icon="search"
|
||||
onClick={() => act("examine", { ref: contents_ref[index] })}
|
||||
/>
|
||||
}
|
||||
<Button
|
||||
icon="eject"
|
||||
onClick={() => act("remove", { ref: contents_ref[index] })}
|
||||
/>
|
||||
</Flex.Item>
|
||||
</Flex>
|
||||
))}
|
||||
{contents.length === 0 && (
|
||||
<Section>
|
||||
<Box color="lightgrey" align="center">
|
||||
This folder is empty!
|
||||
|
||||
Reference in New Issue
Block a user