Skip to content

Commit

Permalink
Remove route privacy from frontend - needs to be added to app instead
Browse files Browse the repository at this point in the history
  • Loading branch information
lil5 committed Feb 14, 2024
1 parent 4f02a59 commit af6af45
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 87 deletions.
9 changes: 1 addition & 8 deletions frontend/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,5 @@
"clickHereToRegister": "<1>Click here</1> to register",
"clickHereToLogin": "<1>Click here</1> to login",
"mustBeRegistered": "You must be registered to create an event",
"userExists": "User already exists",
"routePrivacy-1": "No privacy",
"routePrivacy0": "Full privacy",
"routePrivacy": "Route Privacy",
"routePrivacyInfo": "Defines the visibility of participants within a loop. Set to 'no privacy' to make all participants visible to each other",
"routePrivacyAllVisible": "All participants in the route are visible to one another.",
"routePrivacyNoneVisible": "Participants are not visible to each other in the route.",
"routePrivacyWithCount": "{{ count }} participants above and {{ count }} participants below are visible."
"userExists": "User already exists"
}
2 changes: 0 additions & 2 deletions frontend/src/api/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ export function chainGet(
o: {
addTotals?: boolean;
addIsAppDisabled?: boolean;
addRoutePrivacy?: boolean;
} = {}
) {
return window.axios.get<Chain>("/v2/chain", {
params: {
chain_uid: chainUID,
add_totals: o.addTotals || false,
add_is_app_disabled: o.addIsAppDisabled || false,
add_route_privacy: o.addRoutePrivacy || false,
},
});
}
Expand Down
1 change: 0 additions & 1 deletion frontend/src/api/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export interface RequestRegisterChain {
open_to_new_members: boolean;
sizes: Array<Sizes | string> | null;
genders: Array<Sizes | string> | null;
route_privacy?: number;
allow_toh: boolean;
}

Expand Down
58 changes: 0 additions & 58 deletions frontend/src/components/ChainDetailsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ interface Props {
onSubmit: (values: RegisterChainForm) => void;
initialValues?: RegisterChainForm;
showBack?: boolean;
showRoutePrivacyField?: boolean;
showAllowedTOH: boolean;
}

Expand Down Expand Up @@ -71,7 +70,6 @@ export default function ChainDetailsForm({
onSubmit,
initialValues,
showBack,
showRoutePrivacyField,
showAllowedTOH,
}: Props) {
const { t } = useTranslation();
Expand All @@ -90,7 +88,6 @@ export default function ChainDetailsForm({
sizes: [],
longitude: 0,
latitude: 0,
route_privacy: 2,
...initialValues,
});

Expand Down Expand Up @@ -263,61 +260,6 @@ export default function ChainDetailsForm({
info={t("decideOnTheAreaYourLoopWillBeActiveIn")}
/>

{showRoutePrivacyField && (
<div className="relative">
<TextForm
id="route_privacy_field"
type="number"
required
label={t("routePrivacy")}
name="route_privacy"
value={values.route_privacy}
onChange={(e) =>
setValue("route_privacy", e.target.valueAsNumber)
}
step="1"
min={-1}
info={t("routePrivacyInfo")}
/>
<label
htmlFor="route_privacy_field"
className={"absolute bottom-1 left-4 right-4 h-10 bg-white flex items-center ".concat(
values.route_privacy === undefined || values.route_privacy > 0
? "hidden"
: ""
)}
>
{values.route_privacy === 0
? t("routePrivacy0")
: values.route_privacy === -1
? t("routePrivacy-1")
: null}
</label>
<div className="flex flex-row absolute rtl:left-0 ltr:right-0 h-12 bottom-0 items-center pe-4 gap-2">
<button
type="button"
className="btn btn-circle btn-xs btn-secondary"
onClick={() => {
let rp = values.route_privacy || 0;
if (rp === -1) return;
setValue("route_privacy", rp - 1);
}}
>
<span className="feather feather-minus" />
</button>
<button
type="button"
className="btn btn-circle btn-xs btn-secondary"
onClick={() =>
setValue("route_privacy", (values.route_privacy || 0) + 1)
}
>
<span className="feather feather-plus" />
</button>
</div>
</div>
)}

<div className="form-control relative w-full mb-4">
<PopoverOnHover
message={t("optionalFieldTypeAnything")}
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/pages/ChainEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function ChainEdit() {
useEffect(() => {
(async () => {
try {
let chain = (await chainGet(chainUID, { addRoutePrivacy: true })).data;
let chain = (await chainGet(chainUID)).data;

setChain(chain);
} catch (err: any) {
Expand All @@ -70,7 +70,6 @@ export default function ChainEdit() {
<p className="text-sm mb-1">{t("clickToChangeLoopLocation")}</p>
<ChainDetailsForm
showBack
showRoutePrivacyField
onSubmit={handleSubmit}
initialValues={chain}
showAllowedTOH={!authUser?.accepted_toh}
Expand Down
16 changes: 0 additions & 16 deletions frontend/src/pages/ChainMemberList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,6 @@ export default function ChainMemberList() {
chainGet(chainUID, {
addTotals: true,
addIsAppDisabled: true,
addRoutePrivacy: true,
}),
userGetAllByChain(chainUID),
routeGetOrder(chainUID),
Expand Down Expand Up @@ -557,21 +556,6 @@ export default function ChainMemberList() {
<dd className="text-sm mb-1">
{t("peopleWithCount", { count: users.length })}
</dd>

{isUserAdmin || authUser?.is_root_admin ? (
<>
<dt className="font-bold mb-2">{t("routePrivacy")}</dt>
<dd className="text-sm mb-1">
{chain.route_privacy === 0
? t("routePrivacyNoneVisible")
: chain.route_privacy !== -1
? t("routePrivacyWithCount", {
count: chain.route_privacy,
})
: t("routePrivacyAllVisible")}
</dd>
</>
) : null}
</dl>

{isUserAdmin || authUser?.is_root_admin ? (
Expand Down

0 comments on commit af6af45

Please sign in to comment.