Refactor folder & consistency (#57400)

* refactor folder tsx

* Right-click to remove paper
This commit is contained in:
mozi_h
2021-03-04 17:53:55 +01:00
committed by GitHub
parent 1a9ed6c286
commit a588712ca2
2 changed files with 37 additions and 37 deletions

View File

@@ -27,7 +27,7 @@
/obj/item/folder/examine() /obj/item/folder/examine()
. = ..() . = ..()
if(contents) 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) /obj/item/folder/proc/rename(mob/user)
if(!user.is_literate()) if(!user.is_literate())
@@ -49,10 +49,11 @@
to_chat(user, "<span class='notice'>You remove [Item] from [src].</span>") to_chat(user, "<span class='notice'>You remove [Item] from [src].</span>")
update_icon() update_icon()
/obj/item/folder/AltClick(mob/user) /obj/item/folder/attack_hand(mob/user, list/modifiers)
..() if(LAZYACCESS(modifiers, RIGHT_CLICK))
if(contents)
remove_item(contents[1], user) remove_item(contents[1], user)
return TRUE
. = ..()
/obj/item/folder/update_overlays() /obj/item/folder/update_overlays()
. = ..() . = ..()

View File

@@ -6,40 +6,39 @@ export const Folder = (props, context) => {
const { act, data } = useBackend(context); const { act, data } = useBackend(context);
const { theme, bg_color, folder_name, contents, contents_ref } = data; const { theme, bg_color, folder_name, contents, contents_ref } = data;
return ( 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> <Window.Content backgroundColor={bg_color || "#7f7f7f"} scrollable>
{contents.length > 0 ? ( {contents.map((item, index) => (
<> <Flex
{contents.map((item, index) => ( key={contents_ref[index]}
<> color="black"
<Flex backgroundColor="white"
color="black" style={{ padding: "2px 2px 0 2px" }}
backgroundColor="white" mb={0.5}
style={{ padding: "2px 2px 0 2px" }} >
> <Flex.Item align="center" grow={1}>
<Flex.Item align="center" grow={1}> <Box align="center">{item}</Box>
<Box align="center">{item}</Box> </Flex.Item>
</Flex.Item> <Flex.Item>
<Flex.Item> {
{ <Button
<Button icon="search"
icon="search" onClick={() => act("examine", { ref: contents_ref[index] })}
onClick={() => />
act("examine", { ref: contents_ref[index] })} }
/> <Button
} icon="eject"
<Button onClick={() => act("remove", { ref: contents_ref[index] })}
icon="eject" />
onClick={() => </Flex.Item>
act("remove", { ref: contents_ref[index] })} </Flex>
/> ))}
</Flex.Item> {contents.length === 0 && (
</Flex>
<Box style={{ height: "0.25em" }} />
</>
))}
</>
) : (
<Section> <Section>
<Box color="lightgrey" align="center"> <Box color="lightgrey" align="center">
This folder is empty! This folder is empty!