Wsparcie dla zaimków
This commit is contained in:
parent
d9cacab0a7
commit
2885cc09b6
@ -1,43 +1,40 @@
|
||||
import { EmailTemplate3Config } from './email-template-3';
|
||||
import hostSettingsRadio from './host-settings-radio';
|
||||
|
||||
export default function ConsentProblems({
|
||||
settings,
|
||||
host_id,
|
||||
setConfig,
|
||||
pronoun,
|
||||
}: {
|
||||
host_id: string;
|
||||
setConfig: React.Dispatch<React.SetStateAction<EmailTemplate3Config>>;
|
||||
settings: EmailTemplate3Config['hosts_settings'][string];
|
||||
pronoun: 0 | 1 | 2 | 3;
|
||||
}) {
|
||||
if (settings.legal_basis_type !== 'consent') {
|
||||
return '';
|
||||
}
|
||||
const p = pronoun;
|
||||
return (
|
||||
<div>
|
||||
{hostSettingsRadio({
|
||||
host_id,
|
||||
setConfig,
|
||||
field: 'consent_problems' as const,
|
||||
value: settings.consent_problems,
|
||||
options: {
|
||||
claims_consent_but_sends_before_consent: /* HTML */ `Strona wysłała
|
||||
${p == 3 ? 'nasze' : 'moje'} dane do ${host_id} zanim
|
||||
${['wyraziłem', 'wyraziłam', 'wyraziłom', 'wyraziliśmy'][p]} na to zgodę.`,
|
||||
claims_consent_but_there_was_no_easy_refuse: /* HTML */ `${[
|
||||
'Kliknąłem',
|
||||
'Kliknęłam',
|
||||
'Kliknęłom',
|
||||
'Kliknęliśmy',
|
||||
][p]}
|
||||
przycisk od wyrażania zgody, ale w okienku o zgodę nie było natychmiastowo
|
||||
dostępnego przycisku do niewyrażenia zgody jednym kliknięciem.`,
|
||||
none: 'Żadne z powyższych.',
|
||||
},
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
/* import { EmailTemplate3Config } from './email-template-3';
|
||||
* import hostSettingsRadio from './host-settings-radio';
|
||||
*
|
||||
* export default function ConsentProblems({
|
||||
* settings,
|
||||
* host_id,
|
||||
* setConfig,
|
||||
* pronoun,
|
||||
* }: {
|
||||
* host_id: string;
|
||||
* setConfig: React.Dispatch<React.SetStateAction<EmailTemplate3Config>>;
|
||||
* settings: EmailTemplate3Config['hosts_settings'][string];
|
||||
* pronoun: 0 | 1 | 2 | 3;
|
||||
* }) {
|
||||
* if (settings.legal_basis_type !== 'consent') {
|
||||
* return '';
|
||||
* }
|
||||
* const p = pronoun;
|
||||
* return (
|
||||
* <div>
|
||||
* {hostSettingsRadio({
|
||||
* host_id,
|
||||
* setConfig,
|
||||
* field: 'consent_problems' as const,
|
||||
* value: settings.consent_problems,
|
||||
* options: {
|
||||
* claims_consent_but_sends_before_consent: `Strona wysłała
|
||||
* ${p == 3 ? 'nasze' : 'moje'} dane do ${host_id} zanim
|
||||
* ${['wyraziłem', 'wyraziłam', 'wyraziłom', 'wyraziliśmy'][p]} na to zgodę.`,
|
||||
* claims_consent_but_there_was_no_easy_refuse: `${
|
||||
* ['Kliknąłem', 'Kliknęłam', 'Kliknęłom', 'Kliknęliśmy'][p]
|
||||
* }
|
||||
* przycisk od wyrażania zgody, ale w okienku o zgodę nie było natychmiastowo
|
||||
* dostępnego przycisku do niewyrażenia zgody jednym kliknięciem.`,
|
||||
* none: 'Żadne z powyższych.',
|
||||
* },
|
||||
* })}
|
||||
* </div>
|
||||
* );
|
||||
* } */
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { EmailTemplate3Config } from './email-template-3';
|
||||
import hostSettingsDropdown from './host-setting-dropdown';
|
||||
import ConsentProblems from './consent-problems';
|
||||
/* import hostSettingsDropdown from './host-setting-dropdown'; */
|
||||
/* import ConsentProblems from './consent-problems'; */
|
||||
import LegitimateInteresProblems from './legitimate-interest-problems';
|
||||
import { hostNeedsQuestions } from './host-needs-questions';
|
||||
/* import { hostNeedsQuestions } from './host-needs-questions'; */
|
||||
|
||||
export function setHostSetting<
|
||||
P1 extends keyof EmailTemplate3Config['hosts_settings'],
|
||||
@ -48,12 +48,10 @@ export default function emailHostSettings(
|
||||
<aside>
|
||||
{Object.entries(config.hosts_settings).map(([host_id, settings]) => (
|
||||
<div key={host_id}>
|
||||
<h5>
|
||||
{host_id}, {hostNeedsQuestions(settings).toString()}
|
||||
</h5>
|
||||
<h5>{/* {host_id}, {hostNeedsQuestions(settings).toString()} */}</h5>
|
||||
<p>
|
||||
Cele przetwarzania danych przez właściciela domeny {host_id}{' '}
|
||||
{hostSettingsDropdown({
|
||||
{/* {hostSettingsDropdown({
|
||||
host_id,
|
||||
setConfig,
|
||||
settings,
|
||||
@ -67,13 +65,13 @@ export default function emailHostSettings(
|
||||
],
|
||||
mentioned_in_popup: ['są opisane w okienku RODO'],
|
||||
},
|
||||
})}
|
||||
})} */}
|
||||
</p>
|
||||
{!['not_mentioned', 'null'].includes(settings.presence) ? (
|
||||
<p>
|
||||
Wskazana przez administratora podstawa prawna dla{' '}
|
||||
<strong> tego konkretnego celu</strong>{' '}
|
||||
{hostSettingsDropdown({
|
||||
{/* {hostSettingsDropdown({
|
||||
host_id,
|
||||
setConfig,
|
||||
settings,
|
||||
@ -84,7 +82,7 @@ export default function emailHostSettings(
|
||||
legitimate_interest: ['to uzasadniony interes.'],
|
||||
not_mentioned: ['nie jest wskazana nigdzie na stronie.'],
|
||||
},
|
||||
})}
|
||||
})} */}
|
||||
</p>
|
||||
) : (
|
||||
''
|
||||
|
@ -3,74 +3,64 @@ import * as Survey from 'survey-react';
|
||||
import { toBase64 } from '../util';
|
||||
import emailHostSettings from './email-host-settings';
|
||||
import { EmailTemplate3Config } from './email-template-3';
|
||||
import verbs from './verbs';
|
||||
|
||||
var json = {
|
||||
showQuestionNumbers: 'off',
|
||||
elements: [
|
||||
pages: [
|
||||
{
|
||||
type: 'radiogroup',
|
||||
name: 'haveKids',
|
||||
title: 'Do you have a kid(s)?',
|
||||
isRequired: true,
|
||||
choices: ['Yes', 'No'],
|
||||
colCount: 0,
|
||||
title: 'Zaimki',
|
||||
elements: [
|
||||
{
|
||||
type: 'dropdown',
|
||||
name: 'zaimek',
|
||||
title: 'Forma czasownika:',
|
||||
isRequired: true,
|
||||
choices: [
|
||||
{ value: 0, text: 'Wysłałem' },
|
||||
{ value: 1, text: 'Wysłałam' },
|
||||
{ value: 2, text: 'Wysłałom' },
|
||||
{ value: 3, text: 'Wysłaliśmy' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'dropdown',
|
||||
name: 'kids',
|
||||
title: 'How many kids do you have',
|
||||
visibleIf: "{haveKids}='Yes'",
|
||||
isRequired: true,
|
||||
choices: [1, 2, 3, 4, 5],
|
||||
},
|
||||
{
|
||||
type: 'dropdown',
|
||||
name: 'kid1Age',
|
||||
title: 'The first kid age:',
|
||||
visibleIf: "{haveKids}='Yes' and {kids} >= 1",
|
||||
isRequired: true,
|
||||
choicesMax: 18,
|
||||
},
|
||||
{
|
||||
type: 'dropdown',
|
||||
name: 'kid2Age',
|
||||
title: 'The second kid age:',
|
||||
visibleIf: "{haveKids}='Yes' and {kids} >= 2",
|
||||
isRequired: true,
|
||||
startWithNewLine: false,
|
||||
choicesMax: 18,
|
||||
},
|
||||
{
|
||||
type: 'dropdown',
|
||||
name: 'kid3Age',
|
||||
title: 'The third kid age:',
|
||||
visibleIf: "{haveKids}='Yes' and {kids} >= 3",
|
||||
isRequired: true,
|
||||
startWithNewLine: false,
|
||||
choicesMax: 18,
|
||||
},
|
||||
{
|
||||
type: 'dropdown',
|
||||
name: 'kid4Age',
|
||||
title: 'The fourth kid age:',
|
||||
visibleIf: "{haveKids}='Yes' and {kids} >= 4",
|
||||
isRequired: true,
|
||||
startWithNewLine: false,
|
||||
choicesMax: 18,
|
||||
},
|
||||
{
|
||||
type: 'dropdown',
|
||||
name: 'kid5Age',
|
||||
title: 'The fifth kid age:',
|
||||
visibleIf: "{haveKids}='Yes' and {kids} >= 5",
|
||||
isRequired: true,
|
||||
startWithNewLine: false,
|
||||
choicesMax: 18,
|
||||
title: 'Polityka prywatności',
|
||||
elements: [
|
||||
{
|
||||
type: 'dropdown',
|
||||
title: 'Czy polityka prywatności jest dostępna i czytelna?',
|
||||
isRequired: true,
|
||||
choices: [
|
||||
{ value: 'yes', text: 'dostępna i czytelna' },
|
||||
{
|
||||
value: 'entirely_obscured_by_popup',
|
||||
text: 'dostępna, ale nieczytelna. Zasłania ją popup o RODO',
|
||||
},
|
||||
{
|
||||
value: 'cant_find',
|
||||
text: `Niedostępna. {Szukałem}, ale nie {znalazłem} jej na stronie`,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const survey = new Survey.Model(json);
|
||||
survey.onProcessTextValue.add(function (
|
||||
sender: Survey.SurveyModel,
|
||||
options: { name: string; value?: string }
|
||||
) {
|
||||
if (verbs[options.name.toLowerCase()]) {
|
||||
options.value = verbs[options.name.toLowerCase()][sender.valuesHash.zaimek];
|
||||
if (options.name[0] == options.name[0].toUpperCase()) {
|
||||
options.value = [options.value[0].toUpperCase(), ...options.value.slice(1)].join('');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export default function EmailTemplate3Controls() {
|
||||
return <Survey.Survey model={survey} />;
|
||||
@ -83,57 +73,8 @@ export function _EmailTemplate3Controls({
|
||||
config: EmailTemplate3Config;
|
||||
setConfig: React.Dispatch<React.SetStateAction<EmailTemplate3Config>>;
|
||||
}): JSX.Element {
|
||||
const p = config.pronoun;
|
||||
return (
|
||||
<div>
|
||||
<div>
|
||||
<label htmlFor="pronoun">Forma czasownika:</label>
|
||||
<select
|
||||
id="pronoun"
|
||||
value={config.pronoun}
|
||||
onChange={(e) =>
|
||||
setConfig((v) => ({
|
||||
...v,
|
||||
pronoun: parseInt(e.target.value) as EmailTemplate3Config['pronoun'],
|
||||
}))
|
||||
}
|
||||
>
|
||||
<option value="0">Wysłałem</option>
|
||||
<option value="1">Wysłałam</option>
|
||||
<option value="2">Wysłałom</option>
|
||||
<option value="3">Wysłaliśmy</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label htmlFor="policy_readable">
|
||||
Czy polityka prywatności jest dostępna i czytelna?
|
||||
</label>
|
||||
<select
|
||||
id="policy_readable"
|
||||
value={config.policy_readable}
|
||||
onChange={(e) =>
|
||||
setConfig((v) => ({
|
||||
...v,
|
||||
policy_readable: e.target
|
||||
.value as EmailTemplate3Config['policy_readable'],
|
||||
}))
|
||||
}
|
||||
>
|
||||
<option value="null" disabled>
|
||||
wybierz opcję
|
||||
</option>
|
||||
<option value="yes">dostępna i czytelna</option>
|
||||
<option value="entirely_obscured_by_popup">
|
||||
dostępna, ale nieczytelna. Zasłania ją popup o RODO
|
||||
</option>
|
||||
<option value="cant_find">
|
||||
Niedostępna. {['Szukałem', 'Szukałam', 'Szukałom', 'Szukaliśmy'][p]}, ale
|
||||
nie {['znalazłem', 'znalazłam', 'znalazłom', 'znaleźliśmy'][p]} jej na
|
||||
stronie
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
{emailHostSettings(config, setConfig)}
|
||||
<div>
|
||||
<label htmlFor="poup_type">Typ okienka o RODO: </label>
|
||||
|
@ -1,32 +0,0 @@
|
||||
import { EmailTemplate3Config } from './email-template-3';
|
||||
|
||||
export function hostNeedsQuestions({
|
||||
presence,
|
||||
legal_basis_type,
|
||||
consent_problems,
|
||||
legitimate_interest_activity_description,
|
||||
legitimate_interest_activity_specified,
|
||||
}: EmailTemplate3Config['hosts_settings'][string]) {
|
||||
if (presence == 'not_mentioned') {
|
||||
return false;
|
||||
}
|
||||
if (legal_basis_type == 'not_mentioned') {
|
||||
return false;
|
||||
}
|
||||
if (legal_basis_type == 'consent' && consent_problems !== 'null') {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
legitimate_interest_activity_specified !== 'null' &&
|
||||
legitimate_interest_activity_specified !== 'vague'
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
legal_basis_type == 'legitimate_interest' &&
|
||||
legitimate_interest_activity_description != ''
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
import { setHostSetting } from './email-host-settings';
|
||||
import { EmailTemplate3Config } from './email-template-3';
|
||||
|
||||
export default function hostSettingsDropdown<
|
||||
Field extends keyof EmailTemplate3Config['hosts_settings'][string]
|
||||
>({
|
||||
host_id,
|
||||
setConfig,
|
||||
value,
|
||||
field,
|
||||
options,
|
||||
}: {
|
||||
host_id: string;
|
||||
setConfig: React.Dispatch<React.SetStateAction<EmailTemplate3Config>>;
|
||||
settings: EmailTemplate3Config['hosts_settings'][string];
|
||||
field: Field;
|
||||
value: string;
|
||||
options: Record<
|
||||
Exclude<EmailTemplate3Config['hosts_settings'][string][Field], 'null'>,
|
||||
[string, boolean?]
|
||||
>;
|
||||
}) {
|
||||
return (
|
||||
<select
|
||||
value={value}
|
||||
onChange={(e) =>
|
||||
setHostSetting(
|
||||
setConfig,
|
||||
[host_id, field],
|
||||
e.target.value as EmailTemplate3Config['hosts_settings'][string][typeof field]
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="null" disabled>
|
||||
wybierz opcję
|
||||
</option>
|
||||
{Object.entries(options).map(
|
||||
([value, [display, disabled]]: [string, [string, boolean]]) => (
|
||||
<option value={value} disabled={disabled}>
|
||||
{display}
|
||||
</option>
|
||||
)
|
||||
)}
|
||||
</select>
|
||||
);
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
import { normalizeForClassname } from '../util';
|
||||
import { EmailTemplate3Config } from './email-template-3';
|
||||
|
||||
export default function hostSettingsRadio<
|
||||
Field extends keyof EmailTemplate3Config['hosts_settings'][string]
|
||||
>({
|
||||
options,
|
||||
host_id,
|
||||
field,
|
||||
setConfig,
|
||||
value,
|
||||
}: {
|
||||
host_id: string;
|
||||
setConfig: React.Dispatch<React.SetStateAction<EmailTemplate3Config>>;
|
||||
field: Field;
|
||||
options: Record<Exclude<EmailTemplate3Config['hosts_settings'][string][Field], 'null'>, string>;
|
||||
value: EmailTemplate3Config['hosts_settings'][string][Field];
|
||||
}) {
|
||||
return (
|
||||
<div>
|
||||
{Object.entries(options).map(([option_value, display]) => (
|
||||
<div>
|
||||
<input
|
||||
type="radio"
|
||||
name={normalizeForClassname(host_id + '_consent_problems')}
|
||||
value={option_value}
|
||||
checked={value == option_value}
|
||||
id={normalizeForClassname(option_value + host_id)}
|
||||
onChange={(e) => {
|
||||
setConfig((v) => ({
|
||||
...v,
|
||||
hosts_settings: {
|
||||
...v.hosts_settings,
|
||||
[host_id]: {
|
||||
...v.hosts_settings[host_id],
|
||||
[field]: e.target.value,
|
||||
},
|
||||
},
|
||||
}));
|
||||
}}
|
||||
/>
|
||||
<label htmlFor={normalizeForClassname(option_value + host_id)}>{display}</label>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
import React from 'react';
|
||||
import { setHostSetting } from './email-host-settings';
|
||||
import { EmailTemplate3Config } from './email-template-3';
|
||||
import hostSettingsDropdown from './host-setting-dropdown';
|
||||
|
||||
export default function LegitimateInteresProblems({
|
||||
settings,
|
||||
@ -22,7 +21,7 @@ export default function LegitimateInteresProblems({
|
||||
<div>
|
||||
Czy administrator strony opisał szczegółowo, na czym polega uzasadniony interes w
|
||||
kontekście tego celu?
|
||||
{hostSettingsDropdown({
|
||||
{/* {hostSettingsDropdown({
|
||||
settings,
|
||||
host_id,
|
||||
setConfig,
|
||||
@ -35,7 +34,7 @@ export default function LegitimateInteresProblems({
|
||||
vague: ['Wskazuje tylko ogólnie, jak np. „marketing” czy „statystyki”.'],
|
||||
no: ['Nie. Nie wiadomo, na czym ten uzasadniony interes polega.'],
|
||||
},
|
||||
})}
|
||||
})} */}
|
||||
</div>
|
||||
{settings.legitimate_interest_activity_specified === 'vague' ? (
|
||||
<div>
|
||||
|
5
report-window/verbs.ts
Normal file
5
report-window/verbs.ts
Normal file
@ -0,0 +1,5 @@
|
||||
export default {
|
||||
zrobiłem: ['zrobiłem', 'zrobiłam', 'zrobiłom', 'zrobiliśmy'],
|
||||
szukałem: ['szukałem', 'szukałam', 'szukałom', 'szukaliśmy'],
|
||||
znalazłem: ['znalazłem', 'znalazłam', 'znalazłom', 'znaleźliśmy'],
|
||||
} as { [key: string]: string[] };
|
Loading…
Reference in New Issue
Block a user