Update design of files list in right panel (#144)
* Update design of files list in right panel Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Make i18n script happier Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Improve coverage Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Improve coverage Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Improve coverage Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Discard changes to src/components/structures/MessagePanel.tsx * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix flaky screenshot test Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update screenshot Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
d770e2afcc
commit
07506253f9
20 changed files with 276 additions and 107 deletions
|
@ -21,6 +21,17 @@ import { MediaEventContent } from "matrix-js-sdk/src/types";
|
|||
|
||||
import { _t } from "../languageHandler";
|
||||
|
||||
export function downloadLabelForFile(content: MediaEventContent, withSize = true): string {
|
||||
let text = _t("action|download");
|
||||
|
||||
if (content.info?.size && withSize) {
|
||||
// If we know the size of the file then add it as human-readable string to the end of the link text
|
||||
// so that the user knows how big a file they are downloading.
|
||||
text += " (" + <string>fileSize(content.info.size, { base: 2, standard: "jedec" }) + ")";
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts a human-readable label for the file attachment to use as
|
||||
* link text.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue