From f6b8ef2190134909ec5283acbb48f34347cd61c4 Mon Sep 17 00:00:00 2001 From: Luccas Mateus de Medeiros Gomes Date: Mon, 8 May 2023 08:44:22 -0300 Subject: [PATCH 1/4] [alan-turing][sm] - fixes requested --- .../alan-turing-portal/components/Header.jsx | 10 +---- .../content/{index.md => index.mdx} | 38 ++++++++++++------ examples/alan-turing-portal/markdown.db | Bin 45056 -> 45056 bytes .../alan-turing-portal/pages/[...slug].jsx | 6 ++- .../alan-turing-portal/pages/_document.jsx | 10 +---- examples/alan-turing-portal/pages/index.jsx | 2 +- .../alan-turing-portal/tailwind.config.js | 1 + 7 files changed, 33 insertions(+), 34 deletions(-) rename examples/alan-turing-portal/content/{index.md => index.mdx} (58%) diff --git a/examples/alan-turing-portal/components/Header.jsx b/examples/alan-turing-portal/components/Header.jsx index 98ab6efd..3d438dc9 100644 --- a/examples/alan-turing-portal/components/Header.jsx +++ b/examples/alan-turing-portal/components/Header.jsx @@ -45,16 +45,8 @@ function ModeToggle() { function toggleMode() { disableTransitionsTemporarily() - - let darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)') - let isSystemDarkMode = darkModeMediaQuery.matches let isDarkMode = document.documentElement.classList.toggle('dark') - - if (isDarkMode === isSystemDarkMode) { - delete window.localStorage.isDarkMode - } else { - window.localStorage.isDarkMode = isDarkMode - } + window.localStorage.isDarkMode = isDarkMode } return ( diff --git a/examples/alan-turing-portal/content/index.md b/examples/alan-turing-portal/content/index.mdx similarity index 58% rename from examples/alan-turing-portal/content/index.md rename to examples/alan-turing-portal/content/index.mdx index 758f1739..efd038f6 100644 --- a/examples/alan-turing-portal/content/index.md +++ b/examples/alan-turing-portal/content/index.mdx @@ -12,23 +12,35 @@ If you use these resources, please cite (and read!) our paper: Directions in Abu If you’re looking for a good paper on online hate training datasets (beyond our paper, of course!) then have a look at ‘Resources and benchmark corpora for hate speech detection: a systematic review’ by Poletto et al. in Language Resources and Evaluation. +See the datasets + ## How to contribute We accept entries to our catalogue based on pull requests to the content folder. The dataset must be avaliable for download to be included in the list. If you want to add an entry, follow these steps! Please send just one dataset addition/edit at a time - edit it in, then save. This will make everyone’s life easier (including yours!) -- Go to the repo url file and click the "Add file" dropdown and then click on "Create new file". -![](https://i.imgur.com/2PR0ZgL.png) - -- In the following page type `content/datasets/.md`. if you want to add an entry to the datasets catalog or `content/keywords/.md` if you want to add an entry to the lists of abusive keywords, if you want to just add an static page you can leave in the root of `content` it will automatically get assigned an url eg: `/content/about.md` becomes the `/about` page -![](https://i.imgur.com/rr3uSYu.png) - -- Copy the contents of `templates/dataset.md` or `templates/keywords.md` respectively to the camp below, filling out the fields with the correct data format -![](https://i.imgur.com/x6JIjhz.png) - -- Click on "Commit changes", on the popup make sure you give some brief detail on the proposed change. and then click on Propose changes - - -- Submit the pull request on the next page when prompted. +### Create file + +Go to the repo url file and click the "Add file" dropdown and then click on "Create new file". +![](https://i.imgur.com/2PR0ZgL.png) + +### Choose location + +In the following page type `content/datasets/.md`. if you want to add an entry to the datasets catalog or `content/keywords/.md` if you want to add an entry to the lists of abusive keywords, if you want to just add an static page you can leave in the root of `content` it will automatically get assigned an url eg: `/content/about.md` becomes the `/about` page +![](https://i.imgur.com/rr3uSYu.png) + +### Fill in content + +Copy the contents of `templates/dataset.md` or `templates/keywords.md` respectively to the camp below, filling out the fields with the correct data format +![](https://i.imgur.com/x6JIjhz.png) + +### Commit changes + +Click on "Commit changes", on the popup make sure you give some brief detail on the proposed change. and then click on Propose changes + + +### Submit PR + +Submit the pull request on the next page when prompted. diff --git a/examples/alan-turing-portal/markdown.db b/examples/alan-turing-portal/markdown.db index f47a064d6a49d893c0cd513bf53fa8caaf0984e3..9909701c5763e5e70c462ee37995b899801ff3a7 100644 GIT binary patch delta 453 zcmZp8z|`=7X@a!iVg?2VZXkw%sS|aK85eI%u;XK7**u>whmnJo|2O|P<|~X78{ckb z613oR&1GVb)feVxh)**!NH$3_F*hfD?_Yq{9CfFv*P4hDW--lu#s`4#x9cz5vS z@CosK=D)&sjDPuN1%+;YU1Dux(q@k3oV-C^LkVmy&wB>`H~ee(!}wYGF7c)E3Gi;> zZQ(WMzs4)f^M13T!dafpAAFuOiHb7oGh#S&@@s!d5fA{;?VX84L^{H*;?m zG5E+dal+Nj_ZBPhYzkm=;ALRoU(RpA^_Ja}24OY7or{^7m4W*NdowfZ#>VeVn^}#2 G^8f&7x`FNh delta 448 zcmZp8z|`=7X@a!iOa=x9ZXkw%o{2ifj59YT*zqy4Zl2GV!^p|a|C|3C^EF1MiH+|z z30m+uXEU+K>I(8R#G6?r8Jnf08W^P*86;Ym8d@3|nwc0IrdS$U8km?QrBc`Puj`^QG|#@^0pB { const urlPath = params.slug ? params.slug.join('/') : '' @@ -82,10 +82,12 @@ export default function DRDPage({ mdxSource }) { ) return ( <> +
{meta.title} - + +

diff --git a/examples/alan-turing-portal/pages/_document.jsx b/examples/alan-turing-portal/pages/_document.jsx index 307d1a77..68e37ba4 100644 --- a/examples/alan-turing-portal/pages/_document.jsx +++ b/examples/alan-turing-portal/pages/_document.jsx @@ -1,25 +1,17 @@ import { Head, Html, Main, NextScript } from 'next/document' const modeScript = ` - let darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)') - updateMode() - darkModeMediaQuery.addEventListener('change', updateModeWithoutTransitions) window.addEventListener('storage', updateModeWithoutTransitions) function updateMode() { - let isSystemDarkMode = darkModeMediaQuery.matches - let isDarkMode = window.localStorage.isDarkMode === 'true' || (!('isDarkMode' in window.localStorage) && isSystemDarkMode) + let isDarkMode = window.localStorage.isDarkMode === 'true' if (isDarkMode) { document.documentElement.classList.add('dark') } else { document.documentElement.classList.remove('dark') } - - if (isDarkMode === isSystemDarkMode) { - delete window.localStorage.isDarkMode - } } function disableTransitionsTemporarily() { diff --git a/examples/alan-turing-portal/pages/index.jsx b/examples/alan-turing-portal/pages/index.jsx index 3ee70c68..8d067e0d 100644 --- a/examples/alan-turing-portal/pages/index.jsx +++ b/examples/alan-turing-portal/pages/index.jsx @@ -139,7 +139,7 @@ export default function Home({

{indexText.frontmatter.title}

-
+
diff --git a/examples/alan-turing-portal/tailwind.config.js b/examples/alan-turing-portal/tailwind.config.js index 1717462b..a459329d 100644 --- a/examples/alan-turing-portal/tailwind.config.js +++ b/examples/alan-turing-portal/tailwind.config.js @@ -2,6 +2,7 @@ module.exports = { content: [ "./app/**/*.{js,ts,jsx,tsx,mdx}", + "./content/**/*.{js,ts,jsx,tsx,mdx}", "./pages/**/*.{js,ts,jsx,tsx,mdx}", "./components/**/*.{js,ts,jsx,tsx,mdx}", ], From 43ac5cfb47f7c91d5fe32a1a8c6177b5717b1b6c Mon Sep 17 00:00:00 2001 From: Luccas Mateus de Medeiros Gomes Date: Mon, 8 May 2023 08:56:17 -0300 Subject: [PATCH 2/4] [alan-turing][sm] - fix typo --- examples/alan-turing-portal/content/index.mdx | 2 +- examples/alan-turing-portal/pages/index.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/alan-turing-portal/content/index.mdx b/examples/alan-turing-portal/content/index.mdx index efd038f6..a0458de9 100644 --- a/examples/alan-turing-portal/content/index.mdx +++ b/examples/alan-turing-portal/content/index.mdx @@ -12,7 +12,7 @@ If you use these resources, please cite (and read!) our paper: Directions in Abu If you’re looking for a good paper on online hate training datasets (beyond our paper, of course!) then have a look at ‘Resources and benchmark corpora for hate speech detection: a systematic review’ by Poletto et al. in Language Resources and Evaluation. -See the datasets +See the datasets ## How to contribute diff --git a/examples/alan-turing-portal/pages/index.jsx b/examples/alan-turing-portal/pages/index.jsx index 8d067e0d..4a5d118f 100644 --- a/examples/alan-turing-portal/pages/index.jsx +++ b/examples/alan-turing-portal/pages/index.jsx @@ -146,7 +146,7 @@ export default function Home({
-

+

Datasets

reset())} className="rounded-2xl border border-zinc-100 px-4 py-6 dark:border-zinc-700/40 sm:p-6"> From 4cadc50e4682eb8949f2394b5806bed3918c0da7 Mon Sep 17 00:00:00 2001 From: Luccas Mateus de Medeiros Gomes Date: Mon, 8 May 2023 13:25:34 -0300 Subject: [PATCH 3/4] [alan-turing][m] - additional fixes --- .../alan-turing-portal/components/Header.jsx | 180 +++++++++++++++++- examples/alan-turing-portal/content/index.mdx | 14 +- examples/alan-turing-portal/markdown.db | Bin 45056 -> 45056 bytes examples/alan-turing-portal/pages/index.jsx | 31 ++- 4 files changed, 203 insertions(+), 22 deletions(-) diff --git a/examples/alan-turing-portal/components/Header.jsx b/examples/alan-turing-portal/components/Header.jsx index 3d438dc9..d55e0eeb 100644 --- a/examples/alan-turing-portal/components/Header.jsx +++ b/examples/alan-turing-portal/components/Header.jsx @@ -1,8 +1,41 @@ -import { useRef } from 'react' +import { Fragment, useEffect, useRef } from 'react' +import Image from 'next/image' +import Link from 'next/link' import { useRouter } from 'next/router' +import { Popover, Transition } from '@headlessui/react' +import clsx from 'clsx' import { Container } from '../components/Container' +function CloseIcon(props) { + return ( + + ) +} + +function ChevronDownIcon(props) { + return ( + + ) +} + function SunIcon(props) { return ( + ) +} + +function MobileNavItem({ href, children }) { + return ( +
  • + + {children} + +
  • + ) +} + +function MobileNavigation(props) { + return ( + + + Menu + + + + + + + + +
    + + + +

    + Navigation +

    +
    + +
    +
    +
    +
    + ) +} + +function NavItem({ href, children }) { + let isActive = useRouter().pathname === href + + return ( +
  • + + {children} + {isActive && ( + + )} + +
  • + ) +} + +function DesktopNavigation(props) { + return ( + + ) +} + function ModeToggle() { function disableTransitionsTemporarily() { document.documentElement.classList.add('[&_*]:!transition-none') @@ -45,8 +197,16 @@ function ModeToggle() { function toggleMode() { disableTransitionsTemporarily() + + let darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)') + let isSystemDarkMode = darkModeMediaQuery.matches let isDarkMode = document.documentElement.classList.toggle('dark') - window.localStorage.isDarkMode = isDarkMode + + if (isDarkMode === isSystemDarkMode) { + delete window.localStorage.isDarkMode + } else { + window.localStorage.isDarkMode = isDarkMode + } } return ( @@ -62,11 +222,13 @@ function ModeToggle() { ) } +function clamp(number, a, b) { + let min = Math.min(a, b) + let max = Math.max(a, b) + return Math.min(Math.max(number, min), max) +} + export function Header() { - let isHomePage = useRouter().pathname === '/' - - let headerRef = useRef() - return ( <>
    @@ -86,6 +247,10 @@ export function Header() { style={{ position: 'var(--header-inner-position)' }} >
    +
    + + +
    @@ -95,7 +260,6 @@ export function Header() {
    - {isHomePage &&
    } ) } diff --git a/examples/alan-turing-portal/content/index.mdx b/examples/alan-turing-portal/content/index.mdx index a0458de9..6490f507 100644 --- a/examples/alan-turing-portal/content/index.mdx +++ b/examples/alan-turing-portal/content/index.mdx @@ -4,17 +4,19 @@ title: Hate Speech Dataset Catalogue This page catalogues datasets annotated for hate speech, online abuse, and offensive language. They may be useful for e.g. training a natural language processing system to detect this language. -The list is maintained by Leon Derczynski, Bertie Vidgen, Hannah Rose Kirk, Pica Johansson, Yi-Ling Chung, Mads Guldborg Kjeldgaard Kongsbak, Laila Sprejer, and Philine Zeinert. +The list is maintained by [Leon Derczynski](https://www.derczynski.com/), [Bertie Vidgen](https://www.turing.ac.uk/people/researchers/bertie-vidgen), [Hannah Rose Kirk](https://www.hannahrosekirk.com/), Pica Johansson, [Yi-Ling Chung](https://yilingchung.github.io/), Mads Guldborg Kjeldgaard Kongsbak, [Laila Sprejer](https://www.turing.ac.uk/people/researchers/laila-sprejer), and Philine Zeinert. -We provide a list of datasets and keywords. If you would like to contribute to our catalogue or add your dataset, please see the instructions for contributing. +We provide a list of [datasets](#Datasets-header) and [keywords](#Keywords-header). If you would like to contribute to our catalogue or add your dataset, please see the [instructions for contributing](#Contributing-header). -If you use these resources, please cite (and read!) our paper: Directions in Abusive Language Training Data: Garbage In, Garbage Out. And if you would like to find other resources for researching online hate, visit The Alan Turing Institute’s Online Hate Research Hub or read The Alan Turing Institute’s Reading List on Online Hate and Abuse Research. +If you use these resources, please cite (and read!) our paper: [Directions in Abusive Language Training Data: Garbage In, Garbage Out](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0243300). And if you would like to find other resources for researching online hate, visit The Alan Turing Institute's [Online Hate Research Hub](https://www.turing.ac.uk/research/research-programmes/public-policy/online-hate-research-hub) or read The Alan Turing Institute's [Reading List on Online Hate and Abuse Research](https://docs.google.com/document/d/1WVkVGp29Jt6d-4fBnZ5OWVYuFn_03rzz-KBqPsu6gTM/edit?usp=sharing). -If you’re looking for a good paper on online hate training datasets (beyond our paper, of course!) then have a look at ‘Resources and benchmark corpora for hate speech detection: a systematic review’ by Poletto et al. in Language Resources and Evaluation. +If you're looking for a good paper on online hate training datasets (beyond our paper, of course!) then have a look at ['Resources and benchmark corpora for hate speech detection: a systematic review'](https://link.springer.com/article/10.1007/s10579-020-09502-8) by Poletto et al. in *Language Resources and Evaluation*. -See the datasets +Accompanying [data statements](https://www.mitpressjournals.org/doi/abs/10.1162/tacl_a_00041) preferred for all corpora. -## How to contribute +See the datasets + +

    How to contribute

    We accept entries to our catalogue based on pull requests to the content folder. The dataset must be avaliable for download to be included in the list. If you want to add an entry, follow these steps! diff --git a/examples/alan-turing-portal/markdown.db b/examples/alan-turing-portal/markdown.db index 9909701c5763e5e70c462ee37995b899801ff3a7..0237379cb17304b9987a3167c43d43ac9178ac76 100644 GIT binary patch delta 46 scmZp8z|`=7X@a!ib_NCpZXkw% - {dataset.title} + + {dataset.title} + Link to publication: {' '} - {list.title} + + {list.title} + {list.description && ( List Description: {' '} @@ -139,17 +143,23 @@ export default function Home({

    {indexText.frontmatter.title}

    -
    +
    - +
    -

    +

    Datasets

    - reset())} className="rounded-2xl border border-zinc-100 px-4 py-6 dark:border-zinc-700/40 sm:p-6"> + reset())} + className="rounded-2xl border border-zinc-100 px-4 py-6 dark:border-zinc-700/40 sm:p-6" + >

    Search for datasets

    @@ -198,7 +208,12 @@ export default function Home({ ))} - +
    @@ -225,7 +240,7 @@ export default function Home({
    -

    +

    Lists of Abusive Keywords

    From 61b96c20ed7e5a560a8f51ecefd29cf52d6e100e Mon Sep 17 00:00:00 2001 From: Luccas Mateus de Medeiros Gomes Date: Mon, 8 May 2023 14:36:59 -0300 Subject: [PATCH 4/4] [alan-turing][xs] - fix links --- examples/alan-turing-portal/content/index.mdx | 6 +++++- examples/alan-turing-portal/markdown.db | Bin 45056 -> 45056 bytes 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/alan-turing-portal/content/index.mdx b/examples/alan-turing-portal/content/index.mdx index 6490f507..b4c6bd70 100644 --- a/examples/alan-turing-portal/content/index.mdx +++ b/examples/alan-turing-portal/content/index.mdx @@ -14,7 +14,7 @@ If you're looking for a good paper on online hate training datasets (beyond our Accompanying [data statements](https://www.mitpressjournals.org/doi/abs/10.1162/tacl_a_00041) preferred for all corpora. -See the datasets +See datasets

    How to contribute

    @@ -25,21 +25,25 @@ Please send just one dataset addition/edit at a time - edit it in, then save. Th ### Create file Go to the repo url file and click the "Add file" dropdown and then click on "Create new file". + ![](https://i.imgur.com/2PR0ZgL.png) ### Choose location In the following page type `content/datasets/.md`. if you want to add an entry to the datasets catalog or `content/keywords/.md` if you want to add an entry to the lists of abusive keywords, if you want to just add an static page you can leave in the root of `content` it will automatically get assigned an url eg: `/content/about.md` becomes the `/about` page + ![](https://i.imgur.com/rr3uSYu.png) ### Fill in content Copy the contents of `templates/dataset.md` or `templates/keywords.md` respectively to the camp below, filling out the fields with the correct data format + ![](https://i.imgur.com/x6JIjhz.png) ### Commit changes Click on "Commit changes", on the popup make sure you give some brief detail on the proposed change. and then click on Propose changes + ### Submit PR diff --git a/examples/alan-turing-portal/markdown.db b/examples/alan-turing-portal/markdown.db index 0237379cb17304b9987a3167c43d43ac9178ac76..42b5d695f9dbcea6a3bdf45ba676bdd4fde0812f 100644 GIT binary patch delta 35 jcmZp8z|`=7X@a!iX$A%cZXkw%ofCD88BcFaSg;-do`?x7 delta 35 jcmZp8z|`=7X@a!ib_NCpZXkw%