Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com> Co-authored-by: n15421 <124282010+xzfg-n15421@users.noreply.github.com>
This commit is contained in:
1 parent
352260a7dc
commit
66f7ba18ce
4 files changed
+58
-7
No files matched your search
@@ -1,4 +1,9 @@
|
|||||||
import React, { useEffect, useRef, useState } from 'react';
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
|
import { useLocation, useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
|
const useQuery = () => {
|
||||||
|
return new URLSearchParams(useLocation().search);
|
||||||
|
};
|
||||||
|
|
||||||
export const Collapsibles = ({ children }) => {
|
export const Collapsibles = ({ children }) => {
|
||||||
return (
|
return (
|
||||||
@@ -13,19 +18,47 @@ interface CollapsibleProps {
|
|||||||
subtitle?: React.ReactNode;
|
subtitle?: React.ReactNode;
|
||||||
tags?: string[];
|
tags?: string[];
|
||||||
inner: React.ReactNode;
|
inner: React.ReactNode;
|
||||||
|
id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Collapsible: React.FC<CollapsibleProps> = ({ title, subtitle, inner, tags = [] }) => {
|
export const Collapsible: React.FC<CollapsibleProps> = ({ title, subtitle, inner, tags = [], id }) => {
|
||||||
const [isInnerVisible, setIsInnerVisible] = useState(false);
|
const query = useQuery();
|
||||||
const innerRef = useRef(null);
|
const history = useHistory();
|
||||||
|
|
||||||
|
const initialExpandedState = query.get(id) === 'expanded';
|
||||||
|
const [isInnerVisible, setIsInnerVisible] = useState(initialExpandedState);
|
||||||
|
const innerRef = useRef<HTMLDivElement>(null);
|
||||||
const [innerHeight, setInnerHeight] = useState(0);
|
const [innerHeight, setInnerHeight] = useState(0);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const updateHeight = () => {
|
||||||
|
if (innerRef.current) {
|
||||||
|
setInnerHeight(isInnerVisible ? innerRef.current.scrollHeight : 0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
updateHeight();
|
||||||
|
|
||||||
|
const observer = new MutationObserver(updateHeight);
|
||||||
if (innerRef.current) {
|
if (innerRef.current) {
|
||||||
setInnerHeight(isInnerVisible ? innerRef.current.scrollHeight : 0);
|
observer.observe(innerRef.current, { childList: true, subtree: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
observer.disconnect();
|
||||||
|
};
|
||||||
}, [isInnerVisible]);
|
}, [isInnerVisible]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const params = new URLSearchParams(window.location.search);
|
||||||
|
if (isInnerVisible) {
|
||||||
|
params.set(id, 'expanded');
|
||||||
|
} else {
|
||||||
|
params.delete(id);
|
||||||
|
}
|
||||||
|
history.replace({ search: params.toString() });
|
||||||
|
}, [isInnerVisible, id, history]);
|
||||||
|
|
||||||
const toggleVisibility = () => {
|
const toggleVisibility = () => {
|
||||||
setIsInnerVisible(!isInnerVisible);
|
setIsInnerVisible(!isInnerVisible);
|
||||||
};
|
};
|
||||||
@@ -34,8 +67,13 @@ export const Collapsible: React.FC<CollapsibleProps> = ({ title, subtitle, inner
|
|||||||
<div className="collapsible">
|
<div className="collapsible">
|
||||||
<div className="collapsible-header" onClick={toggleVisibility}>
|
<div className="collapsible-header" onClick={toggleVisibility}>
|
||||||
<p>
|
<p>
|
||||||
<span className="collapsible-title">{title}{tags.map((tag) => (<span className='badge badge--primary' style={{marginLeft:"0.25rem"}}>{tag}</span>))}</span>
|
<span className="collapsible-title">
|
||||||
{subtitle && <span className="collapsible-subtitle"><br/>{subtitle}</span>}
|
{title}
|
||||||
|
{tags.map((tag, index) => (
|
||||||
|
<span key={index} className='badge badge--primary' style={{ marginLeft: "0.25rem" }}>{tag}</span>
|
||||||
|
))}
|
||||||
|
</span>
|
||||||
|
{subtitle && <span className="collapsible-subtitle"><br />{subtitle}</span>}
|
||||||
</p>
|
</p>
|
||||||
<span className={isInnerVisible ? 'collapsible-arrow expanded' : 'collapsible-arrow'}></span>
|
<span className={isInnerVisible ? 'collapsible-arrow expanded' : 'collapsible-arrow'}></span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ const DownloadPage: React.FC = () => (
|
|||||||
<Collapsible
|
<Collapsible
|
||||||
title='GeyserConnect'
|
title='GeyserConnect'
|
||||||
subtitle={<Translate id='pages.download.description.geyserconnect'>A plugin to allow for Geyser players to connect to your server without needing to use a proxy.</Translate>}
|
subtitle={<Translate id='pages.download.description.geyserconnect'>A plugin to allow for Geyser players to connect to your server without needing to use a proxy.</Translate>}
|
||||||
|
id='geyserconnect'
|
||||||
inner={
|
inner={
|
||||||
<ProjectDownload
|
<ProjectDownload
|
||||||
projectId="geyserconnect"
|
projectId="geyserconnect"
|
||||||
@@ -74,6 +75,7 @@ const DownloadPage: React.FC = () => (
|
|||||||
<Collapsible
|
<Collapsible
|
||||||
title='GeyserOptionalPack'
|
title='GeyserOptionalPack'
|
||||||
subtitle={<Translate id='pages.download.description.geyseroptionalpack'>An optional Bedrock resource pack to extend Geyser functionality.</Translate>}
|
subtitle={<Translate id='pages.download.description.geyseroptionalpack'>An optional Bedrock resource pack to extend Geyser functionality.</Translate>}
|
||||||
|
id='geyseroptionalpack'
|
||||||
inner={
|
inner={
|
||||||
<ProjectDownload
|
<ProjectDownload
|
||||||
projectId="geyseroptionalpack"
|
projectId="geyseroptionalpack"
|
||||||
@@ -88,6 +90,7 @@ const DownloadPage: React.FC = () => (
|
|||||||
<Collapsible
|
<Collapsible
|
||||||
title='ThirdPartyCosmetics'
|
title='ThirdPartyCosmetics'
|
||||||
subtitle={<Translate id='pages.download.description.thirdpartycosmetics'>An extension that adds support for loading ears and other third party cosmetics on java players</Translate>}
|
subtitle={<Translate id='pages.download.description.thirdpartycosmetics'>An extension that adds support for loading ears and other third party cosmetics on java players</Translate>}
|
||||||
|
id='thirdpartycosmetics'
|
||||||
inner={
|
inner={
|
||||||
<ProjectDownload
|
<ProjectDownload
|
||||||
projectId="thirdpartycosmetics"
|
projectId="thirdpartycosmetics"
|
||||||
@@ -102,6 +105,7 @@ const DownloadPage: React.FC = () => (
|
|||||||
<Collapsible
|
<Collapsible
|
||||||
title='Hydraulic'
|
title='Hydraulic'
|
||||||
subtitle={<Translate id='pages.download.description.hydraulic'>A companion mod to Geyser which allows for Bedrock players to join modded Minecraft: Java Edition servers.</Translate>}
|
subtitle={<Translate id='pages.download.description.hydraulic'>A companion mod to Geyser which allows for Bedrock players to join modded Minecraft: Java Edition servers.</Translate>}
|
||||||
|
id='hydraulic'
|
||||||
tags={['Beta']}
|
tags={['Beta']}
|
||||||
inner={
|
inner={
|
||||||
<ProjectDownload
|
<ProjectDownload
|
||||||
|
|||||||
Vendored
+9
@@ -0,0 +1,9 @@
|
|||||||
|
declare module '*.module.scss' {
|
||||||
|
const classes: {readonly [key: string]: string};
|
||||||
|
export default classes;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module '*.scss' {
|
||||||
|
const src: string;
|
||||||
|
export default src;
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ title: GeyserOptionalPack
|
|||||||
description: GeyserOptionalPack is a Bedrock resource pack that fixes parity issues with Geyser to bring Bedrock Edition in line with Java Edition.
|
description: GeyserOptionalPack is a Bedrock resource pack that fixes parity issues with Geyser to bring Bedrock Edition in line with Java Edition.
|
||||||
---
|
---
|
||||||
|
|
||||||
## [Download here](https://ci.opencollab.dev/job/GeyserMC/job/GeyserOptionalPack/job/master/lastSuccessfulBuild/artifact/GeyserOptionalPack.mcpack) {#download-here}
|
## [Download here](/download?project=other-projects&geyseroptionalpack=expanded) {#download-here}
|
||||||
|
|
||||||
GeyserOptionalPack is a Bedrock resource pack that adds more features to Geyser to bring Bedrock Edition in line with Java Edition. A resource pack allows various features and bug fixes to be implemented in Bedrock, including:
|
GeyserOptionalPack is a Bedrock resource pack that adds more features to Geyser to bring Bedrock Edition in line with Java Edition. A resource pack allows various features and bug fixes to be implemented in Bedrock, including:
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user