Dashboard-Plugin
Docs HomeDashboard plugins and appsInfomakerNaviga global
  • About
  • Intro
  • Getting started
  • The anatomy of a plugin
  • Manifest structure
  • Getting started
    • Get Dashboard-Plugin
    • Build
  • What's new
  • Components
    • Agent
      • Actions
    • Application
    • Widget
    • Health
    • Modal
    • Settings
  • API and GUI
    • API
      • Overview
      • register
        • Reducers
        • Portals
        • Requirements
        • Permissions
        • Default config
        • Config Modifiers
      • cache
      • store
      • encrypt
      • decrypt
      • createUUID
      • getLanguage
      • getTextDirection
      • getTimeFormat
      • getKeyCharFromCode
      • getKeyCodeFromChar
      • event
      • Logger
      • buildRouteUrlWithDispatchableEvent
      • getUser
      • getAction
      • getPortal
      • getConfig
      • getLocalize
      • getAvailableActions
      • getAvailablePortals
      • request
      • setHealth
      • openModal
      • closeModal
      • confirm
      • notifications
      • hasPermission
      • standalone
      • withUser
      • useModal
      • useSheet
      • useUser
      • useConfig
      • useLocalize
      • useApplication
      • useMappings
      • useStandalone
    • GUI
      • Core GUI
      • Style-Guide
    • Modules
      • GUI
      • Utility
      • NavigaID
        • getUserToken
        • getApplicationToken
        • getGroupsFromToken
  • Mappings
  • Plugins deployments
  • S3 upload
  • Deprecations
    • 4.1.0
    • 4.0.0
    • 2.1.0
Powered by GitBook
On this page
  • Available utilities
  • How to use

Was this helpful?

  1. API and GUI
  2. Modules

Utility

Available utilities

name

description

SuggestSearch

a custom component to do suggestions search towards OC

ArticlePublishFlow

a custom component to handle article publish transitions

DateFNS

custom methods from 'date-fns' lib to handle date and time objects

ArrayMove

ReactSortableHOC

ReactBeautifulDND

Polished

How to use

import { useState } from 'react'

import {
    GUI,
    Utility
} from '@root'

/*
    OR you can import from the modules import name
    import { Utility } from 'Dashboard/modules'
*/

const {
    DateFNS
} = Utility

const App = () => {
    const [dateValue, setDateValue] = useState(new Date())
    
    const handleNextDay = () => {
        const updatedDate = DateFNS.addDays(dateValue, 1)
        setDateValue(updatedDate)
    }
    
    const handlePreviousDay = () => {
        const updatedDate = DateFNS.subDays(dateValue, 1)
        setDateValue(updatedDate)
    }
    
    return (
        <div>
            <GUI.Button onClick={handleNextDay}>
                {'Next day'}
            </GUI.Button>

            <p>{DateFNS.format(dateValue)}</p>
            
            <GUI.Button onClick={handlePreviousDay}>
                {'Previous day'}
            </GUI.Button>
        </div>
    )
}

export default App

With Dashboard-Plugin base from version 2.0.0, we export Utility from '@root' so you can import API methods and Utility from the same import name

PreviousGUINextNavigaID

Last updated 4 years ago

Was this helpful?

instance of lib

instance of lib

instance of lib

instance of lib, to give your styled-components some extra love 😉

'array-move'
'react-sortable-hoc'
'react-beautiful-dnd'
'polished'