mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-25 16:40:58 -05:00
revert: "fix(vite): remove "second" compression pass"
This reverts commit 096e0c84c1
.
This commit is contained in:
parent
1d4eed872b
commit
67936f53ed
4 changed files with 182 additions and 235 deletions
|
@ -151,6 +151,7 @@
|
||||||
"typescript": "^4.4.2",
|
"typescript": "^4.4.2",
|
||||||
"ulid": "^2.3.0",
|
"ulid": "^2.3.0",
|
||||||
"use-resize-observer": "^7.0.0",
|
"use-resize-observer": "^7.0.0",
|
||||||
|
"vite-plugin-compression": "^0.3.6",
|
||||||
"vite-plugin-pwa": "^0.8.1",
|
"vite-plugin-pwa": "^0.8.1",
|
||||||
"workbox-precaching": "^6.1.5"
|
"workbox-precaching": "^6.1.5"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,18 +1,15 @@
|
||||||
import { Plus, LinkExternal } from "@styled-icons/boxicons-regular";
|
import { Plus, LinkExternal } from "@styled-icons/boxicons-regular";
|
||||||
import { Cog, Compass } from "@styled-icons/boxicons-solid";
|
import { Cog, Compass } from "@styled-icons/boxicons-solid";
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import { DragDropContext } from "react-beautiful-dnd";
|
|
||||||
import { Link, useHistory, useLocation, useParams } from "react-router-dom";
|
import { Link, useHistory, useLocation, useParams } from "react-router-dom";
|
||||||
import { RelationshipStatus } from "revolt-api/types/Users";
|
import { RelationshipStatus } from "revolt-api/types/Users";
|
||||||
import styled, { css } from "styled-components";
|
import styled, { css } from "styled-components";
|
||||||
|
|
||||||
import { attachContextMenu } from "preact-context-menu";
|
import { attachContextMenu } from "preact-context-menu";
|
||||||
import { Text } from "preact-i18n";
|
import { Text } from "preact-i18n";
|
||||||
import { useState } from "preact/hooks";
|
|
||||||
|
|
||||||
import ConditionalLink from "../../../lib/ConditionalLink";
|
import ConditionalLink from "../../../lib/ConditionalLink";
|
||||||
import PaintCounter from "../../../lib/PaintCounter";
|
import PaintCounter from "../../../lib/PaintCounter";
|
||||||
import { Draggable, Droppable } from "../../../lib/dnd";
|
|
||||||
import { isTouchscreenDevice } from "../../../lib/isTouchscreenDevice";
|
import { isTouchscreenDevice } from "../../../lib/isTouchscreenDevice";
|
||||||
|
|
||||||
import { useApplicationState } from "../../../mobx/State";
|
import { useApplicationState } from "../../../mobx/State";
|
||||||
|
@ -238,7 +235,7 @@ export default observer(() => {
|
||||||
|
|
||||||
const { server: server_id } = useParams<{ server?: string }>();
|
const { server: server_id } = useParams<{ server?: string }>();
|
||||||
const server = server_id ? client.servers.get(server_id) : undefined;
|
const server = server_id ? client.servers.get(server_id) : undefined;
|
||||||
const [servers, setServers] = useState([...client.servers.values()]);
|
const servers = [...client.servers.values()];
|
||||||
const channels = [...client.channels.values()];
|
const channels = [...client.channels.values()];
|
||||||
|
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
@ -253,51 +250,27 @@ export default observer(() => {
|
||||||
typeof server === "undefined" && !path.startsWith("/invite");
|
typeof server === "undefined" && !path.startsWith("/invite");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DragDropContext
|
|
||||||
onDragEnd={(target) => {
|
|
||||||
if (target.destination) {
|
|
||||||
const arr = [...servers];
|
|
||||||
arr.splice(
|
|
||||||
target.destination.index,
|
|
||||||
0,
|
|
||||||
arr.splice(target.source.index, 1)[0],
|
|
||||||
);
|
|
||||||
setServers(arr);
|
|
||||||
}
|
|
||||||
}}>
|
|
||||||
<ServersBase>
|
<ServersBase>
|
||||||
<Droppable droppableId="server_list">
|
<ServerList>
|
||||||
{(provided) => (
|
|
||||||
<ServerList
|
|
||||||
ref={provided.innerRef}
|
|
||||||
{...provided.droppableProps}>
|
|
||||||
<ConditionalLink
|
<ConditionalLink
|
||||||
active={homeActive}
|
active={homeActive}
|
||||||
to={state.layout.getLastHomePath()}>
|
to={state.layout.getLastHomePath()}>
|
||||||
<ServerEntry home active={homeActive}>
|
<ServerEntry home active={homeActive}>
|
||||||
<Swoosh />
|
<Swoosh />
|
||||||
<div
|
<div
|
||||||
onContextMenu={attachContextMenu(
|
onContextMenu={attachContextMenu("Status")}
|
||||||
"Status",
|
|
||||||
)}
|
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
homeActive &&
|
homeActive && history.push("/settings")
|
||||||
history.push("/settings")
|
|
||||||
}>
|
}>
|
||||||
<UserHover
|
<UserHover user={client.user ?? undefined}>
|
||||||
user={client.user ?? undefined}>
|
|
||||||
<Icon
|
<Icon
|
||||||
size={42}
|
size={42}
|
||||||
unread={
|
unread={
|
||||||
alertCount > 0
|
alertCount > 0 ? "mention" : undefined
|
||||||
? "mention"
|
|
||||||
: undefined
|
|
||||||
}
|
}
|
||||||
count={alertCount}>
|
count={alertCount}>
|
||||||
<UserIcon
|
<UserIcon
|
||||||
target={
|
target={client.user ?? undefined}
|
||||||
client.user ?? undefined
|
|
||||||
}
|
|
||||||
size={32}
|
size={32}
|
||||||
status
|
status
|
||||||
hover
|
hover
|
||||||
|
@ -321,13 +294,10 @@ export default observer(() => {
|
||||||
<ServerEntry
|
<ServerEntry
|
||||||
home
|
home
|
||||||
active={false}
|
active={false}
|
||||||
onContextMenu={attachContextMenu(
|
onContextMenu={attachContextMenu("Menu", {
|
||||||
"Menu",
|
|
||||||
{
|
|
||||||
channel: x._id,
|
channel: x._id,
|
||||||
unread: true,
|
unread: true,
|
||||||
},
|
})}>
|
||||||
)}>
|
|
||||||
<div>
|
<div>
|
||||||
<Icon
|
<Icon
|
||||||
size={42}
|
size={42}
|
||||||
|
@ -340,9 +310,7 @@ export default observer(() => {
|
||||||
{x.channel_type ===
|
{x.channel_type ===
|
||||||
"DirectMessage" ? (
|
"DirectMessage" ? (
|
||||||
<UserIcon
|
<UserIcon
|
||||||
target={
|
target={x.recipient}
|
||||||
x.recipient
|
|
||||||
}
|
|
||||||
size={32}
|
size={32}
|
||||||
hover
|
hover
|
||||||
/>
|
/>
|
||||||
|
@ -360,82 +328,49 @@ export default observer(() => {
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
<LineDivider />
|
<LineDivider />
|
||||||
{servers.map((server, index) => {
|
{servers.map((server) => {
|
||||||
const active = server._id === server_id;
|
const active = server._id === server_id;
|
||||||
|
|
||||||
const isUnread = server.isUnread(
|
const isUnread = server.isUnread(state.notifications);
|
||||||
state.notifications,
|
|
||||||
);
|
|
||||||
const mentionCount = server.getMentions(
|
const mentionCount = server.getMentions(
|
||||||
state.notifications,
|
state.notifications,
|
||||||
).length;
|
).length;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Draggable
|
|
||||||
key={server._id}
|
|
||||||
draggableId={server._id}
|
|
||||||
index={index}>
|
|
||||||
{(provided, snapshot) => (
|
|
||||||
<div
|
|
||||||
{...provided.draggableProps}
|
|
||||||
{...provided.dragHandleProps}
|
|
||||||
ref={provided.innerRef}>
|
|
||||||
<ConditionalLink
|
<ConditionalLink
|
||||||
|
key={server._id}
|
||||||
active={active}
|
active={active}
|
||||||
to={state.layout.getServerPath(
|
to={state.layout.getServerPath(server._id)}>
|
||||||
server._id,
|
|
||||||
)}>
|
|
||||||
<ServerEntry
|
<ServerEntry
|
||||||
active={active}
|
active={active}
|
||||||
onContextMenu={attachContextMenu(
|
onContextMenu={attachContextMenu("Menu", {
|
||||||
"Menu",
|
|
||||||
{
|
|
||||||
server: server._id,
|
server: server._id,
|
||||||
unread: isUnread,
|
unread: isUnread,
|
||||||
},
|
})}>
|
||||||
)}>
|
|
||||||
{!snapshot.isDragging && (
|
|
||||||
<Swoosh />
|
<Swoosh />
|
||||||
)}
|
|
||||||
|
|
||||||
<Tooltip
|
<Tooltip
|
||||||
content={
|
content={server.name}
|
||||||
server.name
|
|
||||||
}
|
|
||||||
placement="right">
|
placement="right">
|
||||||
<Icon
|
<Icon
|
||||||
size={42}
|
size={42}
|
||||||
unread={
|
unread={
|
||||||
mentionCount >
|
mentionCount > 0
|
||||||
0
|
|
||||||
? "mention"
|
? "mention"
|
||||||
: isUnread
|
: isUnread
|
||||||
? "unread"
|
? "unread"
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
count={
|
count={mentionCount}>
|
||||||
mentionCount
|
<ServerIcon size={32} target={server} />
|
||||||
}>
|
|
||||||
<ServerIcon
|
|
||||||
size={32}
|
|
||||||
target={
|
|
||||||
server
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</Icon>
|
</Icon>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</ServerEntry>
|
</ServerEntry>
|
||||||
</ConditionalLink>
|
</ConditionalLink>
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</Draggable>
|
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
{provided.placeholder}
|
{/*<LineDivider />*/}
|
||||||
<ServerCircle>
|
<ServerCircle>
|
||||||
<Tooltip
|
<Tooltip content="Add a Server" placement="right">
|
||||||
content="Add a Server"
|
|
||||||
placement="right">
|
|
||||||
<div className="circle">
|
<div className="circle">
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
|
@ -476,8 +411,6 @@ export default observer(() => {
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</ServerCircle>
|
</ServerCircle>
|
||||||
</ServerList>
|
</ServerList>
|
||||||
)}
|
|
||||||
</Droppable>
|
|
||||||
<PaintCounter small />
|
<PaintCounter small />
|
||||||
{!isTouchscreenDevice && (
|
{!isTouchscreenDevice && (
|
||||||
<SettingsButton>
|
<SettingsButton>
|
||||||
|
@ -493,6 +426,5 @@ export default observer(() => {
|
||||||
</SettingsButton>
|
</SettingsButton>
|
||||||
)}
|
)}
|
||||||
</ServersBase>
|
</ServersBase>
|
||||||
</DragDropContext>
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,6 +2,7 @@ import replace from "@rollup/plugin-replace";
|
||||||
import { readFileSync } from "fs";
|
import { readFileSync } from "fs";
|
||||||
import { resolve } from "path";
|
import { resolve } from "path";
|
||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
|
import viteCompression from "vite-plugin-compression";
|
||||||
import { VitePWA } from "vite-plugin-pwa";
|
import { VitePWA } from "vite-plugin-pwa";
|
||||||
|
|
||||||
import preact from "@preact/preset-vite";
|
import preact from "@preact/preset-vite";
|
||||||
|
@ -42,6 +43,10 @@ function getVersion() {
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [
|
plugins: [
|
||||||
|
viteCompression({
|
||||||
|
verbose: true,
|
||||||
|
algorithm: "brotliCompress",
|
||||||
|
}),
|
||||||
preact(),
|
preact(),
|
||||||
VitePWA({
|
VitePWA({
|
||||||
srcDir: "src",
|
srcDir: "src",
|
||||||
|
|
11
yarn.lock
11
yarn.lock
|
@ -1887,7 +1887,7 @@ chalk@^2.0.0:
|
||||||
escape-string-regexp "^1.0.5"
|
escape-string-regexp "^1.0.5"
|
||||||
supports-color "^5.3.0"
|
supports-color "^5.3.0"
|
||||||
|
|
||||||
chalk@^4.0.0:
|
chalk@^4.0.0, chalk@^4.1.2:
|
||||||
version "4.1.2"
|
version "4.1.2"
|
||||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
|
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
|
||||||
integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
|
integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
|
||||||
|
@ -4357,6 +4357,15 @@ value-equal@^1.0.1:
|
||||||
resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-1.0.1.tgz#1e0b794c734c5c0cade179c437d356d931a34d6c"
|
resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-1.0.1.tgz#1e0b794c734c5c0cade179c437d356d931a34d6c"
|
||||||
integrity sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw==
|
integrity sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw==
|
||||||
|
|
||||||
|
vite-plugin-compression@^0.3.6:
|
||||||
|
version "0.3.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/vite-plugin-compression/-/vite-plugin-compression-0.3.6.tgz#85e3ce5047ae6747bc3952177177a852fac901be"
|
||||||
|
integrity sha512-aSskQCJsP3VQ8PsnY+vO7UfD5qoFMOEuzg0PG2E9Zqyx+ARmc3wr9KCgOFraZOFW1Y4UAa5BR0SMTjoxHRMJoQ==
|
||||||
|
dependencies:
|
||||||
|
chalk "^4.1.2"
|
||||||
|
debug "^4.3.2"
|
||||||
|
fs-extra "^10.0.0"
|
||||||
|
|
||||||
vite-plugin-pwa@^0.8.1:
|
vite-plugin-pwa@^0.8.1:
|
||||||
version "0.8.2"
|
version "0.8.2"
|
||||||
resolved "https://registry.yarnpkg.com/vite-plugin-pwa/-/vite-plugin-pwa-0.8.2.tgz#2789a157e2f71faf834d968945efc22eee9ad64a"
|
resolved "https://registry.yarnpkg.com/vite-plugin-pwa/-/vite-plugin-pwa-0.8.2.tgz#2789a157e2f71faf834d968945efc22eee9ad64a"
|
||||||
|
|
Loading…
Reference in a new issue