Compare commits

...

4 Commits

Author SHA1 Message Date
Elias Schneider
905bab9c86 release: 0.3.4 2022-12-10 15:46:53 +01:00
Elias Schneider
7e877ce9f4 fix: show alternative to copy button if site is not using https 2022-12-10 13:16:23 +01:00
Elias Schneider
b1bfb09dfd fix: tables on mobile 2022-12-09 14:37:09 +01:00
Elias Schneider
c8a4521677 fix: sign up page available when registration is disabled 2022-12-09 12:05:43 +01:00
8 changed files with 108 additions and 66 deletions

View File

@@ -1,3 +1,12 @@
### [0.3.4](https://github.com/stonith404/pingvin-share/compare/v0.3.3...v0.3.4) (2022-12-10)
### Bug Fixes
* show alternative to copy button if site is not using https ([7e877ce](https://github.com/stonith404/pingvin-share/commit/7e877ce9f4b82d61c9b238e17def9f4c29e7aeb8))
* sign up page available when registration is disabled ([c8a4521](https://github.com/stonith404/pingvin-share/commit/c8a4521677280d6aba89d293a1fe0c38adf9f92c))
* tables on mobile ([b1bfb09](https://github.com/stonith404/pingvin-share/commit/b1bfb09dfd5c90cc18847470a9ce1ce8397c1476))
### [0.3.3](https://github.com/stonith404/pingvin-share/compare/v0.3.2...v0.3.3) (2022-12-08) ### [0.3.3](https://github.com/stonith404/pingvin-share/compare/v0.3.2...v0.3.3) (2022-12-08)

View File

@@ -0,0 +1,16 @@
import { Stack, TextInput } from "@mantine/core";
import { ModalsContextProps } from "@mantine/modals/lib/context";
const showShareLinkModal = (modals: ModalsContextProps, shareId: string) => {
const link = `${window.location.origin}/share/${shareId}`;
return modals.openModal({
title: "Share link",
children: (
<Stack align="stretch">
<TextInput variant="filled" value={link} />
</Stack>
),
});
};
export default showShareLinkModal;

View File

@@ -1,4 +1,12 @@
import { ActionIcon, Code, Group, Skeleton, Table, Text } from "@mantine/core"; import {
ActionIcon,
Box,
Code,
Group,
Skeleton,
Table,
Text,
} from "@mantine/core";
import { useModals } from "@mantine/modals"; import { useModals } from "@mantine/modals";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { TbEdit, TbLock } from "react-icons/tb"; import { TbEdit, TbLock } from "react-icons/tb";
@@ -43,53 +51,55 @@ const AdminConfigTable = () => {
)); ));
return ( return (
<Table verticalSpacing="sm" horizontalSpacing="xl" withBorder> <Box sx={{ display: "block", overflowX: "auto" }}>
<thead> <Table verticalSpacing="sm" horizontalSpacing="xl" withBorder>
<tr> <thead>
<th>Key</th> <tr>
<th>Value</th> <th>Key</th>
<th></th> <th>Value</th>
</tr> <th></th>
</thead> </tr>
<tbody> </thead>
{isLoading <tbody>
? skeletonRows {isLoading
: configVariables.map((configVariable) => ( ? skeletonRows
<tr key={configVariable.key}> : configVariables.map((configVariable) => (
<td style={{ maxWidth: "200px" }}> <tr key={configVariable.key}>
<Code>{configVariable.key}</Code>{" "} <td style={{ maxWidth: "200px" }}>
{configVariable.secret && <TbLock />} <br /> <Code>{configVariable.key}</Code>{" "}
<Text size="xs" color="dimmed"> {configVariable.secret && <TbLock />} <br />
{configVariable.description} <Text size="xs" color="dimmed">
</Text> {configVariable.description}
</td> </Text>
<td> </td>
{configVariable.obscured <td>
? "•".repeat(configVariable.value.length) {configVariable.obscured
: configVariable.value} ? "•".repeat(configVariable.value.length)
</td> : configVariable.value}
<td> </td>
<Group position="right"> <td>
<ActionIcon <Group position="right">
color="primary" <ActionIcon
variant="light" color="primary"
size={25} variant="light"
onClick={() => size={25}
showUpdateConfigVariableModal( onClick={() =>
modals, showUpdateConfigVariableModal(
configVariable, modals,
getConfigVariables configVariable,
) getConfigVariables
} )
> }
<TbEdit /> >
</ActionIcon> <TbEdit />
</Group> </ActionIcon>
</td> </Group>
</tr> </td>
))} </tr>
</tbody> ))}
</Table> </tbody>
</Table>
</Box>
); );
}; };

View File

@@ -18,8 +18,8 @@ const ManageUserTable = ({
const modals = useModals(); const modals = useModals();
return ( return (
<Box sx={{ display: "block", overflowX: "auto", whiteSpace: "nowrap" }}> <Box sx={{ display: "block", overflowX: "auto" }}>
<Table verticalSpacing="sm" highlightOnHover> <Table verticalSpacing="sm">
<thead> <thead>
<tr> <tr>
<th>Username</th> <th>Username</th>

View File

@@ -40,14 +40,16 @@ const Body = ({ share }: { share: Share }) => {
variant="filled" variant="filled"
value={link} value={link}
rightSection={ rightSection={
<ActionIcon window.isSecureContext && (
onClick={() => { <ActionIcon
clipboard.copy(link); onClick={() => {
toast.success("Your link was copied to the keyboard."); clipboard.copy(link);
}} toast.success("Your link was copied to the keyboard.");
> }}
<TbCopy /> >
</ActionIcon> <TbCopy />
</ActionIcon>
)
} }
/> />
<Text <Text

View File

@@ -17,6 +17,7 @@ import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { TbLink, TbTrash } from "react-icons/tb"; import { TbLink, TbTrash } from "react-icons/tb";
import showShareLinkModal from "../../components/account/showShareLinkModal";
import Meta from "../../components/Meta"; import Meta from "../../components/Meta";
import useUser from "../../hooks/user.hook"; import useUser from "../../hooks/user.hook";
import shareService from "../../services/share.service"; import shareService from "../../services/share.service";
@@ -83,12 +84,16 @@ const MyShares = () => {
variant="light" variant="light"
size={25} size={25}
onClick={() => { onClick={() => {
clipboard.copy( if (window.isSecureContext) {
`${window.location.origin}/share/${share.id}` clipboard.copy(
); `${window.location.origin}/share/${share.id}`
toast.success( );
"Your link was copied to the keyboard." toast.success(
); "Your link was copied to the keyboard."
);
} else {
showShareLinkModal(modals, share.id);
}
}} }}
> >
<TbLink /> <TbLink />

View File

@@ -10,7 +10,7 @@ const SignUp = () => {
const router = useRouter(); const router = useRouter();
if (user) { if (user) {
router.replace("/"); router.replace("/");
} else if (config.get("ALLOW_REGISTRATION") == "false") { } else if (!config.get("ALLOW_REGISTRATION")) {
router.replace("/auth/signIn"); router.replace("/auth/signIn");
} else { } else {
return ( return (

View File

@@ -1,6 +1,6 @@
{ {
"name": "pingvin-share", "name": "pingvin-share",
"version": "0.3.3", "version": "0.3.4",
"scripts": { "scripts": {
"format": "cd frontend && npm run format && cd ../backend && npm run format", "format": "cd frontend && npm run format && cd ../backend && npm run format",
"lint": "cd frontend && npm run lint && cd ../backend && npm run lint", "lint": "cd frontend && npm run lint && cd ../backend && npm run lint",