1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-25 06:24:19 +00:00

🔧 Use useStrings instead of useContext(ContextLanguage)

This commit is contained in:
Steffo 2021-05-24 14:13:24 +02:00
parent 1e14b1910a
commit 957a6c892f
Signed by: steffo
GPG key ID: 6965406171929D01
24 changed files with 60 additions and 60 deletions

View file

@ -1,11 +1,11 @@
import React, { useCallback, useContext } from "react" import React, { useCallback } from "react"
import BoxFull from "../base/BoxFull" import BoxFull from "../base/BoxFull"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { faClock } from "@fortawesome/free-solid-svg-icons" import { faClock } from "@fortawesome/free-solid-svg-icons"
import useRepositoryEditor from "../../hooks/useRepositoryEditor" import useRepositoryEditor from "../../hooks/useRepositoryEditor"
import ContextLanguage from "../../contexts/ContextLanguage"
import FormInlineTimeRay from "./FormInlineTimeRay" import FormInlineTimeRay from "./FormInlineTimeRay"
import { ConditionTime } from "../../objects/Condition" import { ConditionTime } from "../../objects/Condition"
import useStrings from "../../hooks/useStrings"
/** /**
@ -18,7 +18,7 @@ import { ConditionTime } from "../../objects/Condition"
*/ */
export default function BoxConditionDatetime({ ...props }) { export default function BoxConditionDatetime({ ...props }) {
const { addCondition } = useRepositoryEditor() const { addCondition } = useRepositoryEditor()
const { strings } = useContext(ContextLanguage) const strings = useStrings()
const submit = useCallback( const submit = useCallback(
timeRay => addCondition(new ConditionTime(timeRay)), timeRay => addCondition(new ConditionTime(timeRay)),

View file

@ -1,11 +1,11 @@
import React, { useCallback, useContext } from "react" import React, { useCallback } from "react"
import BoxFull from "../base/BoxFull" import BoxFull from "../base/BoxFull"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { faHashtag } from "@fortawesome/free-solid-svg-icons" import { faHashtag } from "@fortawesome/free-solid-svg-icons"
import useRepositoryEditor from "../../hooks/useRepositoryEditor" import useRepositoryEditor from "../../hooks/useRepositoryEditor"
import ContextLanguage from "../../contexts/ContextLanguage"
import FormInlineHashtag from "./FormInlineHashtag" import FormInlineHashtag from "./FormInlineHashtag"
import { ConditionHashtag } from "../../objects/Condition" import { ConditionHashtag } from "../../objects/Condition"
import useStrings from "../../hooks/useStrings"
/** /**
@ -18,7 +18,7 @@ import { ConditionHashtag } from "../../objects/Condition"
*/ */
export default function BoxConditionHashtag({ ...props }) { export default function BoxConditionHashtag({ ...props }) {
const { addCondition } = useRepositoryEditor() const { addCondition } = useRepositoryEditor()
const { strings } = useContext(ContextLanguage) const strings = useStrings()
const submit = useCallback( const submit = useCallback(
value => addCondition(new ConditionHashtag(value)), value => addCondition(new ConditionHashtag(value)),

View file

@ -1,12 +1,12 @@
import React, { useCallback, useContext } from "react" import React, { useCallback } from "react"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { faLocationArrow, faPlus } from "@fortawesome/free-solid-svg-icons" import { faLocationArrow, faPlus } from "@fortawesome/free-solid-svg-icons"
import ButtonIconOnly from "../base/ButtonIconOnly" import ButtonIconOnly from "../base/ButtonIconOnly"
import useRepositoryEditor from "../../hooks/useRepositoryEditor" import useRepositoryEditor from "../../hooks/useRepositoryEditor"
import ContextLanguage from "../../contexts/ContextLanguage"
import BoxMap from "../base/BoxMap" import BoxMap from "../base/BoxMap"
import useMapAreaState from "../../hooks/useMapAreaState" import useMapAreaState from "../../hooks/useMapAreaState"
import { ConditionLocation } from "../../objects/Condition" import { ConditionLocation } from "../../objects/Condition"
import useStrings from "../../hooks/useStrings"
/** /**
@ -20,7 +20,7 @@ import { ConditionLocation } from "../../objects/Condition"
export default function BoxConditionLocation({ ...props }) { export default function BoxConditionLocation({ ...props }) {
const mapViewHook = useMapAreaState() const mapViewHook = useMapAreaState()
const { addCondition } = useRepositoryEditor() const { addCondition } = useRepositoryEditor()
const { strings } = useContext(ContextLanguage) const strings = useStrings()
const onButtonClick = useCallback( const onButtonClick = useCallback(
() => addCondition(new ConditionLocation(mapViewHook.mapArea)), () => addCondition(new ConditionLocation(mapViewHook.mapArea)),

View file

@ -1,11 +1,11 @@
import React, { useCallback, useContext } from "react" import React, { useCallback } from "react"
import BoxFull from "../base/BoxFull" import BoxFull from "../base/BoxFull"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { faAt } from "@fortawesome/free-solid-svg-icons" import { faAt } from "@fortawesome/free-solid-svg-icons"
import useRepositoryEditor from "../../hooks/useRepositoryEditor" import useRepositoryEditor from "../../hooks/useRepositoryEditor"
import ContextLanguage from "../../contexts/ContextLanguage"
import FormInlineUser from "./FormInlineUser" import FormInlineUser from "./FormInlineUser"
import { ConditionUser } from "../../objects/Condition" import { ConditionUser } from "../../objects/Condition"
import useStrings from "../../hooks/useStrings"
/** /**
@ -18,7 +18,7 @@ import { ConditionUser } from "../../objects/Condition"
*/ */
export default function BoxConditionUser({ ...props }) { export default function BoxConditionUser({ ...props }) {
const { addCondition } = useRepositoryEditor() const { addCondition } = useRepositoryEditor()
const { strings } = useContext(ContextLanguage) const strings = useStrings()
const submit = useCallback( const submit = useCallback(
value => addCondition(new ConditionUser(value)), value => addCondition(new ConditionUser(value)),

View file

@ -1,8 +1,8 @@
import React, { useContext } from "react" import React from "react"
import BoxFull from "../base/BoxFull" import BoxFull from "../base/BoxFull"
import BadgeCondition from "./BadgeCondition" import BadgeCondition from "./BadgeCondition"
import useRepositoryEditor from "../../hooks/useRepositoryEditor" import useRepositoryEditor from "../../hooks/useRepositoryEditor"
import ContextLanguage from "../../contexts/ContextLanguage" import useStrings from "../../hooks/useStrings"
/** /**
@ -14,7 +14,7 @@ import ContextLanguage from "../../contexts/ContextLanguage"
*/ */
export default function BoxConditions({ ...props }) { export default function BoxConditions({ ...props }) {
const { conditions } = useRepositoryEditor() const { conditions } = useRepositoryEditor()
const { strings } = useContext(ContextLanguage) const strings = useStrings()
const badges = conditions.map((cond, pos) => <BadgeCondition key={pos} condition={cond}/>) const badges = conditions.map((cond, pos) => <BadgeCondition key={pos} condition={cond}/>)

View file

@ -1,8 +1,8 @@
import React, { useContext } from "react" import React, { useContext } from "react"
import BoxFull from "../base/BoxFull" import BoxFull from "../base/BoxFull"
import ContextLanguage from "../../contexts/ContextLanguage"
import ContextRepositoryViewer from "../../contexts/ContextRepositoryViewer" import ContextRepositoryViewer from "../../contexts/ContextRepositoryViewer"
import BadgeFilter from "./BadgeFilter" import BadgeFilter from "./BadgeFilter"
import useStrings from "../../hooks/useStrings"
/** /**
@ -13,7 +13,7 @@ import BadgeFilter from "./BadgeFilter"
* @constructor * @constructor
*/ */
export default function BoxFilters({ ...props }) { export default function BoxFilters({ ...props }) {
const { strings } = useContext(ContextLanguage) const strings = useStrings()
const { filters } = useContext(ContextRepositoryViewer) const { filters } = useContext(ContextRepositoryViewer)
const badges = filters.map((filter, pos) => <BadgeFilter key={pos} filter={filter}/>) const badges = filters.map((filter, pos) => <BadgeFilter key={pos} filter={filter}/>)

View file

@ -7,7 +7,7 @@ import ContextUser from "../../contexts/ContextUser"
import { useHistory } from "react-router" import { useHistory } from "react-router"
import Style from "./BoxLoggedIn.module.css" import Style from "./BoxLoggedIn.module.css"
import CurrentServer from "./CurrentServer" import CurrentServer from "./CurrentServer"
import ContextLanguage from "../../contexts/ContextLanguage" import useStrings from "../../hooks/useStrings"
/** /**
@ -20,7 +20,7 @@ import ContextLanguage from "../../contexts/ContextLanguage"
export default function BoxLoggedIn({ ...props }) { export default function BoxLoggedIn({ ...props }) {
const { logout } = useContext(ContextUser) const { logout } = useContext(ContextUser)
const history = useHistory() const history = useHistory()
const { strings } = useContext(ContextLanguage) const strings = useStrings()
return ( return (
<BoxFull header={strings.loggedInTitle} {...props}> <BoxFull header={strings.loggedInTitle} {...props}>

View file

@ -8,7 +8,7 @@ import FormButton from "../base/formparts/FormButton"
import ContextUser from "../../contexts/ContextUser" import ContextUser from "../../contexts/ContextUser"
import { useHistory } from "react-router" import { useHistory } from "react-router"
import FormAlert from "../base/formparts/FormAlert" import FormAlert from "../base/formparts/FormAlert"
import ContextLanguage from "../../contexts/ContextLanguage" import useStrings from "../../hooks/useStrings"
/** /**
@ -25,7 +25,7 @@ export default function BoxLogin({ ...props }) {
const [error, setError] = useState(null) const [error, setError] = useState(null)
const { login } = useContext(ContextUser) const { login } = useContext(ContextUser)
const history = useHistory() const history = useHistory()
const { strings } = useContext(ContextLanguage) const strings = useStrings()
const doLogin = async () => { const doLogin = async () => {
if(working) { if(working) {

View file

@ -1,4 +1,4 @@
import React, { useContext } from "react" import React from "react"
import BoxFull from "../base/BoxFull" import BoxFull from "../base/BoxFull"
import FormLabelled from "../base/FormLabelled" import FormLabelled from "../base/FormLabelled"
import FormLabel from "../base/formparts/FormLabel" import FormLabel from "../base/formparts/FormLabel"
@ -8,9 +8,8 @@ import Radio from "../base/Radio"
import Button from "../base/Button" import Button from "../base/Button"
import useRepositoryEditor from "../../hooks/useRepositoryEditor" import useRepositoryEditor from "../../hooks/useRepositoryEditor"
import FormAlert from "../base/formparts/FormAlert" import FormAlert from "../base/formparts/FormAlert"
import goToOnSuccess from "../../utils/goToOnSuccess"
import { useHistory } from "react-router" import { useHistory } from "react-router"
import ContextLanguage from "../../contexts/ContextLanguage" import useStrings from "../../hooks/useStrings"
/** /**
@ -34,7 +33,7 @@ export default function BoxRepositoryCreate({ running, ...props }) {
} = useRepositoryEditor() } = useRepositoryEditor()
const history = useHistory() const history = useHistory()
const { strings } = useContext(ContextLanguage) const strings = useStrings()
return ( return (
<BoxFull header={strings.createRepo} {...props}> <BoxFull header={strings.createRepo} {...props}>

View file

@ -5,7 +5,7 @@ import FormLabel from "../base/formparts/FormLabel"
import InputWithIcon from "../base/InputWithIcon" import InputWithIcon from "../base/InputWithIcon"
import { faGlobe } from "@fortawesome/free-solid-svg-icons" import { faGlobe } from "@fortawesome/free-solid-svg-icons"
import ContextServer from "../../contexts/ContextServer" import ContextServer from "../../contexts/ContextServer"
import ContextLanguage from "../../contexts/ContextLanguage" import useStrings from "../../hooks/useStrings"
/** /**
@ -17,7 +17,7 @@ import ContextLanguage from "../../contexts/ContextLanguage"
*/ */
export default function BoxSetServer({ ...props }) { export default function BoxSetServer({ ...props }) {
const { server, setServer } = useContext(ContextServer) const { server, setServer } = useContext(ContextServer)
const { strings } = useContext(ContextLanguage) const strings = useStrings()
return ( return (
<BoxFull header={strings.server} {...props}> <BoxFull header={strings.server} {...props}>

View file

@ -1,4 +1,4 @@
import React, { useCallback, useContext, useState } from "react" import React, { useCallback, useState } from "react"
import FormLabelled from "../base/FormLabelled" import FormLabelled from "../base/FormLabelled"
import FormLabel from "../base/formparts/FormLabel" import FormLabel from "../base/formparts/FormLabel"
import InputWithIcon from "../base/InputWithIcon" import InputWithIcon from "../base/InputWithIcon"
@ -6,7 +6,7 @@ import { faEnvelope, faKey, faPlus, faUser } from "@fortawesome/free-solid-svg-i
import FormButton from "../base/formparts/FormButton" import FormButton from "../base/formparts/FormButton"
import BoxFull from "../base/BoxFull" import BoxFull from "../base/BoxFull"
import FormAlert from "../base/formparts/FormAlert" import FormAlert from "../base/formparts/FormAlert"
import ContextLanguage from "../../contexts/ContextLanguage" import useStrings from "../../hooks/useStrings"
/** /**
@ -23,7 +23,7 @@ export default function BoxUserCreate({ createUser, running, ...props }) {
const [email, setEmail] = useState("") const [email, setEmail] = useState("")
const [password, setPassword] = useState("") const [password, setPassword] = useState("")
const [error, setError] = useState(undefined) const [error, setError] = useState(undefined)
const { strings } = useContext(ContextLanguage) const strings = useStrings()
const onButtonClick = useCallback( const onButtonClick = useCallback(
async () => { async () => {

View file

@ -2,12 +2,12 @@ import React, { useContext, useMemo } from "react"
import BoxFull from "../base/BoxFull" import BoxFull from "../base/BoxFull"
import BoxChart from "../base/BoxChart" import BoxChart from "../base/BoxChart"
import Empty from "./Empty" import Empty from "./Empty"
import ContextLanguage from "../../contexts/ContextLanguage"
import ContextRepositoryViewer from "../../contexts/ContextRepositoryViewer" import ContextRepositoryViewer from "../../contexts/ContextRepositoryViewer"
import useStrings from "../../hooks/useStrings"
export default function BoxVisualizationChart({ ...props }) { export default function BoxVisualizationChart({ ...props }) {
const { strings } = useContext(ContextLanguage) const strings = useStrings()
const { tweets } = useContext(ContextRepositoryViewer) const { tweets } = useContext(ContextRepositoryViewer)
const chartProps = useMemo( const chartProps = useMemo(

View file

@ -1,9 +1,9 @@
import React, { useContext, useMemo } from "react" import React, { useContext, useMemo } from "react"
import BoxMap from "../base/BoxMap" import BoxMap from "../base/BoxMap"
import ContextLanguage from "../../contexts/ContextLanguage"
import { Marker, Popup } from "react-leaflet" import { Marker, Popup } from "react-leaflet"
import Coordinates from "../../objects/Coordinates" import Coordinates from "../../objects/Coordinates"
import ContextRepositoryViewer from "../../contexts/ContextRepositoryViewer" import ContextRepositoryViewer from "../../contexts/ContextRepositoryViewer"
import useStrings from "../../hooks/useStrings"
/** /**
@ -14,7 +14,7 @@ import ContextRepositoryViewer from "../../contexts/ContextRepositoryViewer"
* @constructor * @constructor
*/ */
export default function BoxVisualizationMap({ ...props }) { export default function BoxVisualizationMap({ ...props }) {
const { strings } = useContext(ContextLanguage) const strings = useStrings()
const { tweets, mapViewHook } = useContext(ContextRepositoryViewer) const { tweets, mapViewHook } = useContext(ContextRepositoryViewer)
const markers = useMemo( const markers = useMemo(

View file

@ -1,13 +1,13 @@
import React, { useContext, useMemo } from "react" import React, { useContext, useMemo } from "react"
import FormLabelled from "../base/FormLabelled" import FormLabelled from "../base/FormLabelled"
import FormLabel from "../base/formparts/FormLabel" import FormLabel from "../base/formparts/FormLabel"
import ContextLanguage from "../../contexts/ContextLanguage"
import BoxFullScrollable from "../base/BoxFullScrollable" import BoxFullScrollable from "../base/BoxFullScrollable"
import ContextRepositoryViewer from "../../contexts/ContextRepositoryViewer" import ContextRepositoryViewer from "../../contexts/ContextRepositoryViewer"
import useStrings from "../../hooks/useStrings"
export default function BoxVisualizationStats({ ...props }) { export default function BoxVisualizationStats({ ...props }) {
const { strings } = useContext(ContextLanguage) const strings = useStrings()
const { tweets, words, rawTweets } = useContext(ContextRepositoryViewer) const { tweets, words, rawTweets } = useContext(ContextRepositoryViewer)
const tweetCount = useMemo( const tweetCount = useMemo(

View file

@ -1,14 +1,14 @@
import React, { useCallback, useContext } from "react" import React, { useCallback, useContext } from "react"
import BoxWordcloud from "../base/BoxWordcloud" import BoxWordcloud from "../base/BoxWordcloud"
import ContextLanguage from "../../contexts/ContextLanguage"
import BoxFull from "../base/BoxFull" import BoxFull from "../base/BoxFull"
import Empty from "./Empty" import Empty from "./Empty"
import ContextRepositoryViewer from "../../contexts/ContextRepositoryViewer" import ContextRepositoryViewer from "../../contexts/ContextRepositoryViewer"
import { FilterContains } from "../../objects/Filter" import { FilterContains } from "../../objects/Filter"
import useStrings from "../../hooks/useStrings"
export default function BoxVisualizationWordcloud({ ...props }) { export default function BoxVisualizationWordcloud({ ...props }) {
const { strings } = useContext(ContextLanguage) const strings = useStrings()
const { words, appendFilter } = useContext(ContextRepositoryViewer) const { words, appendFilter } = useContext(ContextRepositoryViewer)
if(words.length === 0) { if(words.length === 0) {

View file

@ -1,8 +1,8 @@
import React, { useContext } from "react" import React from "react"
import Style from "./ButtonToggleBeforeAfter.module.css" import Style from "./ButtonToggleBeforeAfter.module.css"
import classNames from "classnames" import classNames from "classnames"
import Button from "../base/Button" import Button from "../base/Button"
import ContextLanguage from "../../contexts/ContextLanguage" import useStrings from "../../hooks/useStrings"
/** /**
@ -16,7 +16,7 @@ import ContextLanguage from "../../contexts/ContextLanguage"
* @constructor * @constructor
*/ */
export default function ButtonToggleBeforeAfter({ isBefore, setBefore, className, ...props }) { export default function ButtonToggleBeforeAfter({ isBefore, setBefore, className, ...props }) {
const { strings } = useContext(ContextLanguage) const strings = useStrings()
const onButtonClick = () => { const onButtonClick = () => {
setBefore(a => !a) setBefore(a => !a)

View file

@ -1,7 +1,7 @@
import React, { useContext } from "react" import React from "react"
import Style from "./Empty.module.css" import Style from "./Empty.module.css"
import classNames from "classnames" import classNames from "classnames"
import ContextLanguage from "../../contexts/ContextLanguage" import useStrings from "../../hooks/useStrings"
/** /**
@ -13,7 +13,7 @@ import ContextLanguage from "../../contexts/ContextLanguage"
* @constructor * @constructor
*/ */
export default function Empty({ className, ...props }) { export default function Empty({ className, ...props }) {
const { strings } = useContext(ContextLanguage) const strings = useStrings()
return ( return (
<i className={classNames(Style.Empty, className)} {...props}> <i className={classNames(Style.Empty, className)} {...props}>

View file

@ -2,7 +2,7 @@ import React, { useContext } from "react"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { faUser } from "@fortawesome/free-solid-svg-icons" import { faUser } from "@fortawesome/free-solid-svg-icons"
import ContextUser from "../../contexts/ContextUser" import ContextUser from "../../contexts/ContextUser"
import ContextLanguage from "../../contexts/ContextLanguage" import useStrings from "../../hooks/useStrings"
/** /**
@ -14,7 +14,7 @@ import ContextLanguage from "../../contexts/ContextLanguage"
*/ */
export default function LoggedInUser({ ...props }) { export default function LoggedInUser({ ...props }) {
const { user } = useContext(ContextUser) const { user } = useContext(ContextUser)
const { strings } = useContext(ContextLanguage) const strings = useStrings()
if(!user) { if(!user) {
return ( return (

View file

@ -4,7 +4,7 @@ import LogoDark from "../../media/LogoDark.png"
import LogoLight from "../../media/LogoLight.png" import LogoLight from "../../media/LogoLight.png"
import ContextTheme from "../../contexts/ContextTheme" import ContextTheme from "../../contexts/ContextTheme"
import classNames from "classnames" import classNames from "classnames"
import ContextLanguage from "../../contexts/ContextLanguage" import useStrings from "../../hooks/useStrings"
/** /**
@ -19,7 +19,7 @@ import ContextLanguage from "../../contexts/ContextLanguage"
*/ */
export default function Logo({ className, ...props }) { export default function Logo({ className, ...props }) {
const { theme } = useContext(ContextTheme) const { theme } = useContext(ContextTheme)
const { strings } = useContext(ContextLanguage) const strings = useStrings()
let logo let logo
if(theme === "ThemeDark") { if(theme === "ThemeDark") {

View file

@ -1,7 +1,7 @@
import React, { useContext } from "react" import React, { useContext } from "react"
import Select from "../base/Select" import Select from "../base/Select"
import ContextTheme from "../../contexts/ContextTheme" import ContextTheme from "../../contexts/ContextTheme"
import ContextLanguage from "../../contexts/ContextLanguage" import useStrings from "../../hooks/useStrings"
/** /**
@ -14,7 +14,7 @@ import ContextLanguage from "../../contexts/ContextLanguage"
*/ */
export default function SelectTheme({ ...props }) { export default function SelectTheme({ ...props }) {
const { theme, setTheme } = useContext(ContextTheme) const { theme, setTheme } = useContext(ContextTheme)
const { strings } = useContext(ContextLanguage) const strings = useStrings()
return ( return (
<Select value={theme} onChange={e => setTheme(e.target.value)} {...props}> <Select value={theme} onChange={e => setTheme(e.target.value)} {...props}>

View file

@ -3,9 +3,9 @@ import Style from "./Sidebar.module.css"
import classNames from "classnames" import classNames from "classnames"
import Logo from "../interactive/Logo" import Logo from "../interactive/Logo"
import ButtonSidebar from "../base/ButtonSidebar" import ButtonSidebar from "../base/ButtonSidebar"
import { faCog, faExclamationTriangle, faFolder, faHome, faKey, faUserCog } from "@fortawesome/free-solid-svg-icons" import { faCog, faHome, faKey, faUserCog } from "@fortawesome/free-solid-svg-icons"
import ContextUser from "../../contexts/ContextUser" import ContextUser from "../../contexts/ContextUser"
import ContextLanguage from "../../contexts/ContextLanguage" import useStrings from "../../hooks/useStrings"
/** /**
@ -18,7 +18,7 @@ import ContextLanguage from "../../contexts/ContextLanguage"
*/ */
export default function Sidebar({ className, ...props }) { export default function Sidebar({ className, ...props }) {
const { user } = useContext(ContextUser) const { user } = useContext(ContextUser)
const { strings } = useContext(ContextLanguage) const strings = useStrings()
return ( return (
<aside className={classNames(Style.Sidebar, className)} {...props}> <aside className={classNames(Style.Sidebar, className)} {...props}>

View file

@ -1,4 +1,4 @@
import React, { useContext } from "react" import React from "react"
import { import {
faArchive, faArchive,
faBell, faBell,
@ -8,12 +8,12 @@ import {
faShare, faShare,
faTrash, faTrash,
} from "@fortawesome/free-solid-svg-icons" } from "@fortawesome/free-solid-svg-icons"
import ContextLanguage from "../../contexts/ContextLanguage"
import SummaryBase from "../base/summary/SummaryBase" import SummaryBase from "../base/summary/SummaryBase"
import SummaryLeft from "../base/summary/SummaryLeft" import SummaryLeft from "../base/summary/SummaryLeft"
import SummaryLabels from "../base/summary/SummaryLabels" import SummaryLabels from "../base/summary/SummaryLabels"
import SummaryButton from "../base/summary/SummaryButton" import SummaryButton from "../base/summary/SummaryButton"
import SummaryRight from "../base/summary/SummaryRight" import SummaryRight from "../base/summary/SummaryRight"
import useStrings from "../../hooks/useStrings"
/** /**
@ -35,7 +35,7 @@ import SummaryRight from "../base/summary/SummaryRight"
export default function SummaryRepository( export default function SummaryRepository(
{ repo, view, alerts, share, archive, edit, destroy, running, className, ...props }, { repo, view, alerts, share, archive, edit, destroy, running, className, ...props },
) { ) {
const { strings } = useContext(ContextLanguage) const strings = useStrings()
return ( return (
<SummaryBase {...props}> <SummaryBase {...props}>

View file

@ -1,6 +1,5 @@
import React, { useContext } from "react" import React, { useContext } from "react"
import { faShare, faStar, faTrash, faUser } from "@fortawesome/free-solid-svg-icons" import { faShare, faStar, faTrash, faUser } from "@fortawesome/free-solid-svg-icons"
import ContextLanguage from "../../contexts/ContextLanguage"
import SummaryBase from "../base/summary/SummaryBase" import SummaryBase from "../base/summary/SummaryBase"
import SummaryLeft from "../base/summary/SummaryLeft" import SummaryLeft from "../base/summary/SummaryLeft"
import SummaryLabels from "../base/summary/SummaryLabels" import SummaryLabels from "../base/summary/SummaryLabels"
@ -8,6 +7,7 @@ import SummaryButton from "../base/summary/SummaryButton"
import SummaryRight from "../base/summary/SummaryRight" import SummaryRight from "../base/summary/SummaryRight"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import ContextUser from "../../contexts/ContextUser" import ContextUser from "../../contexts/ContextUser"
import useStrings from "../../hooks/useStrings"
/** /**
@ -23,7 +23,7 @@ import ContextUser from "../../contexts/ContextUser"
* @constructor * @constructor
*/ */
export default function SummaryUser({ user, shareWithUser, unshareWithUser, destroyUser, running, ...props }) { export default function SummaryUser({ user, shareWithUser, unshareWithUser, destroyUser, running, ...props }) {
const { strings } = useContext(ContextLanguage) const strings = useStrings()
const {user: loggedUser} = useContext(ContextUser) const {user: loggedUser} = useContext(ContextUser)
return ( return (

View file

@ -8,10 +8,11 @@ import useBackendViewset from "../hooks/useBackendViewset"
import { useParams } from "react-router" import { useParams } from "react-router"
import ContextUser from "../contexts/ContextUser" import ContextUser from "../contexts/ContextUser"
import BoxAlert from "../components/base/BoxAlert" import BoxAlert from "../components/base/BoxAlert"
import useStrings from "../hooks/useStrings"
export default function PageShare({ className, ...props }) { export default function PageShare({ className, ...props }) {
const { strings } = useContext(ContextLanguage) const strings = useStrings()
const { user: loggedUser } = useContext(ContextUser) const { user: loggedUser } = useContext(ContextUser)
const { id } = useParams() const { id } = useParams()