Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision 00e4dbd184a8eecfc8921431fcd1ecc2f966177e authored by Sanmisan on 13 October 2023, 20:18:23 UTC, committed by GitHub on 13 October 2023, 20:18:23 UTC
Update README.md
teaser img
1 parent b49b4e1
  • Files
  • Changes
  • ba30466
  • /
  • src
  • /
  • components
  • /
  • linterReport
  • /
  • backgroundOption.js
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
revision badge
swh:1:rev:00e4dbd184a8eecfc8921431fcd1ecc2f966177e
directory badge
swh:1:dir:3a6001675a60a09dd3a2e8557c76d115d49d2e22
content badge
swh:1:cnt:0e7f913f2b1da3639affc4a94ff7de3a49e40880

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
backgroundOption.js
import React, {Component} from "react";
import "../../styles/LinterReport.css"
import arrow from "../../resource/arrow.png";
import {Card, Row, Col, Select, Input, Button, Image, Popover, InputNumber} from 'antd';
import { SketchPicker } from 'react-color'
import reactCSS from 'reactcss'

class BgOption extends Component {
    state = {
        color: {
          r: '0',
          g: '0',
          b: '0',
          a: '100',
        },
        bgcolor: {
            r: '243',
            g: '248',
            b: '251',
            a: '100',
        },
        background: '#F3F8FB',
        title: null,
        stroke: null,
        strokeWidth: null,
        className: "softRuleCard",
        ifFixed: "",
      };    
    
      handleChange = (color) => {
        //console.log(color);
        this.setState({ 
            color: color.rgb,
            stroke: color.hex
        });
      };

      handleStrokeWidth = (val) => {
        this.setState({
            strokeWidth: val 
        });
    };

    handleBgChange = (color) => {
        //console.log(color);
        this.setState({
            bgcolor: color.rgb,
            background: color.hex
        });
    };

    handleFix = () => {
        let option = {
            background: this.state.background,
            stroke: this.state.stroke,
            strokeWidth: this.state.strokeWidth,
            title: this.state.title
        };

        this.props.mapOptionSetting(option);
    };

    render(){
        let mapFeatureReady = this.props.mapFeatureReady;
        const { Option } = Select;

        const styles = reactCSS({
            'default': {
              color: {
                width: '50px',
                height: '14px',
                borderRadius: '2px',
                background: `rgba(${ this.state.color.r }, ${ this.state.color.g }, ${ this.state.color.b }, ${ this.state.color.a })`,
              },
              swatch: {
                padding: '5px',
                background: '#fff',
                borderRadius: '1px',
                boxShadow: '0 0 0 1px rgba(0,0,0,.1)',
                display: 'inline-block',
                cursor: 'pointer',
              },
              popover: {
                position: 'absolute',
                zIndex: '2',
              },
              cover: {
                position: 'fixed',
                top: '0px',
                right: '0px',
                bottom: '0px',
                left: '0px',
              },
            },
          });

          const bgStyles = reactCSS({
            'default': {
              color: {
                width: '50px',
                height: '14px',
                borderRadius: '2px',
                background: `rgba(${ this.state.bgcolor.r }, ${ this.state.bgcolor.g }, ${ this.state.bgcolor.b }, ${ this.state.bgcolor.a })`,
              },
              swatch: {
                padding: '5px',
                background: '#fff',
                borderRadius: '1px',
                boxShadow: '0 0 0 1px rgba(0,0,0,.1)',
                display: 'inline-block',
                cursor: 'pointer',
              },
              popover: {
                position: 'absolute',
                zIndex: '2',
              },
              cover: {
                position: 'fixed',
                top: '0px',
                right: '0px',
                bottom: '0px',
                left: '0px',
              },
            },
          });

          const strokeColorDiv = (
            <div>
                <SketchPicker 
                    color={ this.state.color }
                    disableAlpha={true}
                    presetColors={['#ffffff','#f0f0f0','#d9d9d9','#bdbdbd','#969696','#737373','#525252','#252525','#000000']}
                    onChange={ this.handleChange } 
                />
            </div>
          );

          const bgColorDiv = (
            <div>
                <SketchPicker 
                    color={ this.state.bgcolor }
                    disableAlpha={true}
                    presetColors={['#F3F8FB','#ffffff','#f0f0f0','#d9d9d9','#bdbdbd','#969696','#737373','#525252','#252525','#000000']}
                    onChange={ this.handleBgChange } 
                />
            </div>
          );
      
        if(mapFeatureReady !== null && this.state.classificationList !== null){
            return(
                <Card
                title={"Soft rule violations are detected" + this.state.ifFixed}
                size='small'
                className={this.state.className}
                extra={
                    <div
                        style={{
                            display: 'inline-block',
                            height: 40,
                            fontSize: 12
                        }}
                    >
                        <Button
                         size="small" 
                         type="primary"
                         style={{
                            float:'left',
                            width: 80,
                            marginTop: 7,
                            marginRight: 30
                        }}
                        onClick={this.handleFix}
                        >
                            Fix
                        </Button>
                    </div>
                }
                >

                <div style={{padding: 8}}>
                <Row gutter={[5,5]}>
                    <Col span={24}><b style={{color: "red"}}>1. {this.props.backgroundColor}</b></Col>
                    
                    <Col span={24}>
                    <Row>
                    <Col span={1}>
                        <Image
                            width={15}
                            src={arrow}
                            preview={false}    
                        />
                        </Col>

                        <Col span={23}>
                            <Row>
                                <Col span={10}>
                                    <b>Map background color:</b> 
                                </Col>
                                <Col span={14}>
                                    <Popover content={bgColorDiv}>
                                        <div style={ bgStyles.swatch }>
                                            <div style={ bgStyles.color } />
                                        </div>
                                    </Popover>                               
                                </Col>
                            </Row>
                        </Col>
                    </Row>
                    </Col>
    
                </Row>
                </div>
                
                </Card>
                
            );
        }else{
            return(
                <div></div>
            );
        }

    }
}
export default BgOption;
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API